org.junit.runner.Description#EMPTY源码实例Demo

下面列出了org.junit.runner.Description#EMPTY 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@Test
public void verifyFailureStackTraceIsTruncated() throws Exception {
  InstrumentationResultPrinter intrResultPrinter = new InstrumentationResultPrinter();
  intrResultPrinter.testNum = 1;

  Failure testFailure = new Failure(Description.EMPTY, new Exception(getVeryLargeString()));
  intrResultPrinter.testFailure(testFailure);

  int testResultTraceLength =
      intrResultPrinter.testResult.getString(REPORT_KEY_STACK).length() - 1;
  assertTrue(
      String.format(
          "The stack trace length: %s, exceeds the max: %s",
          testResultTraceLength, MAX_TRACE_SIZE),
      testResultTraceLength <= MAX_TRACE_SIZE);
}
 
源代码2 项目: astor   文件: JUnitFailureHackerTest.java
@Test
public void shouldReplaceException() throws Exception {
    //given
    RuntimeException actualExc = new RuntimeException("foo");
    Failure failure = new Failure(Description.EMPTY, actualExc);
    
    //when
    hacker.appendWarnings(failure, "unused stubbing");
            
    //then
    assertEquals(ExceptionIncludingMockitoWarnings.class, failure.getException().getClass());
    assertEquals(actualExc, failure.getException().getCause());
    Assertions.assertThat(actualExc.getStackTrace()).isEqualTo(failure.getException().getStackTrace());
}
 
源代码3 项目: astor   文件: JUnitFailureHackerTest.java
@Test
public void shouldAppendWarning() throws Exception {
    Failure failure = new Failure(Description.EMPTY, new RuntimeException("foo"));
    
    //when
    hacker.appendWarnings(failure, "unused stubbing blah");
    
    //then
    assertContains("unused stubbing blah", failure.getException().getMessage());        
}
 
源代码4 项目: astor   文件: JUnitFailureHackerTest.java
@Test
public void shouldNotAppendWhenNoWarnings() throws Exception {
    RuntimeException ex = new RuntimeException("foo");
    Failure failure = new Failure(Description.EMPTY, ex);
    
    //when
    hacker.appendWarnings(failure, "");
    
    //then
    assertEquals(ex, failure.getException());        
}
 
源代码5 项目: astor   文件: JUnitFailureHackerTest.java
@Test
public void shouldNotAppendWhenNullWarnings() throws Exception {
    RuntimeException ex = new RuntimeException("foo");
    Failure failure = new Failure(Description.EMPTY, ex);
    
    //when
    hacker.appendWarnings(failure, null);
    
    //then
    assertEquals(ex, failure.getException());        
}
 
源代码6 项目: astor   文件: JUnitFailureHackerTest.java
@Test
public void shouldPrintTheWarningSoICanSeeIt() throws Exception {
    Failure failure = new Failure(Description.EMPTY, new RuntimeException("foo"));
    
    //when
    hacker.appendWarnings(failure, "unused stubbing blah");
    
    //then
    System.out.println(failure.getException());        
}
 
源代码7 项目: astor   文件: JUnitFailureHackerTest.java
@Test
public void shouldReplaceException() throws Exception {
    //given
    RuntimeException actualExc = new RuntimeException("foo");
    Failure failure = new Failure(Description.EMPTY, actualExc);
    
    //when
    hacker.appendWarnings(failure, "unused stubbing");
            
    //then
    assertEquals(ExceptionIncludingMockitoWarnings.class, failure.getException().getClass());
    assertEquals(actualExc, failure.getException().getCause());
    Assertions.assertThat(actualExc.getStackTrace()).isEqualTo(failure.getException().getStackTrace());
}
 
源代码8 项目: astor   文件: JUnitFailureHackerTest.java
@Test
public void shouldAppendWarning() throws Exception {
    Failure failure = new Failure(Description.EMPTY, new RuntimeException("foo"));
    
    //when
    hacker.appendWarnings(failure, "unused stubbing blah");
    
    //then
    assertContains("unused stubbing blah", failure.getException().getMessage());        
}
 
源代码9 项目: astor   文件: JUnitFailureHackerTest.java
@Test
public void shouldNotAppendWhenNoWarnings() throws Exception {
    RuntimeException ex = new RuntimeException("foo");
    Failure failure = new Failure(Description.EMPTY, ex);
    
    //when
    hacker.appendWarnings(failure, "");
    
    //then
    assertEquals(ex, failure.getException());        
}
 
源代码10 项目: astor   文件: JUnitFailureHackerTest.java
@Test
public void shouldNotAppendWhenNullWarnings() throws Exception {
    RuntimeException ex = new RuntimeException("foo");
    Failure failure = new Failure(Description.EMPTY, ex);
    
    //when
    hacker.appendWarnings(failure, null);
    
    //then
    assertEquals(ex, failure.getException());        
}
 
源代码11 项目: astor   文件: JUnitFailureHackerTest.java
@Test
public void shouldPrintTheWarningSoICanSeeIt() throws Exception {
    Failure failure = new Failure(Description.EMPTY, new RuntimeException("foo"));
    
    //when
    hacker.appendWarnings(failure, "unused stubbing blah");
    
    //then
    System.out.println(failure.getException());        
}
 
源代码12 项目: component-runtime   文件: DelegatingRunnerTest.java
@Override
public Description getDescription() {
    STEPS.add("description");
    return Description.EMPTY;
}
 
源代码13 项目: android-test   文件: AndroidJUnit3Builder.java
@Override
public Description getDescription() {
  return Description.EMPTY;
}