Java Code Examples for org.junit.runner.Description#EMPTY
The following examples show how to use
org.junit.runner.Description#EMPTY .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InstrumentationResultPrinterTest.java From android-test with Apache License 2.0 | 6 votes |
@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); }
Example 2
Source File: JUnitFailureHackerTest.java From astor with GNU General Public License v2.0 | 5 votes |
@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()); }
Example 3
Source File: JUnitFailureHackerTest.java From astor with GNU General Public License v2.0 | 5 votes |
@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()); }
Example 4
Source File: JUnitFailureHackerTest.java From astor with GNU General Public License v2.0 | 5 votes |
@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()); }
Example 5
Source File: JUnitFailureHackerTest.java From astor with GNU General Public License v2.0 | 5 votes |
@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()); }
Example 6
Source File: JUnitFailureHackerTest.java From astor with GNU General Public License v2.0 | 5 votes |
@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()); }
Example 7
Source File: JUnitFailureHackerTest.java From astor with GNU General Public License v2.0 | 5 votes |
@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()); }
Example 8
Source File: JUnitFailureHackerTest.java From astor with GNU General Public License v2.0 | 5 votes |
@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()); }
Example 9
Source File: JUnitFailureHackerTest.java From astor with GNU General Public License v2.0 | 5 votes |
@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()); }
Example 10
Source File: JUnitFailureHackerTest.java From astor with GNU General Public License v2.0 | 5 votes |
@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()); }
Example 11
Source File: JUnitFailureHackerTest.java From astor with GNU General Public License v2.0 | 5 votes |
@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()); }
Example 12
Source File: DelegatingRunnerTest.java From component-runtime with Apache License 2.0 | 4 votes |
@Override public Description getDescription() { STEPS.add("description"); return Description.EMPTY; }
Example 13
Source File: AndroidJUnit3Builder.java From android-test with Apache License 2.0 | 4 votes |
@Override public Description getDescription() { return Description.EMPTY; }