CuppaRunner extends Runner { @Override public Description getDescription() { Description description = createSuiteDescription(testClass.getName(), rootBlock.description); rootBlock.testBlocks.forEach(b -> description.addChild(getDescriptionOfDescribeBlock(b, Collections.singletonList(rootBlock)))); return description; } CuppaRunner(Class<?> annotatedClass); @Override Description getDescription(); @Override void run(RunNotifier notifier);  }
@Test public void shouldReportFailingTestDescription() { Result result = JUnitCore.runClasses(CuppaRunnerTest.FailingTest.class); assertThat(result.getFailures()).hasSize(1); Failure failure = result.getFailures().get(0); assertThat(failure.getDescription().getDisplayName()) .isEqualTo("shows a failing test as failing(org.forgerock.cuppa.junit.CuppaRunnerTest$FailingTest)"); }
@Test public void shouldReportErroringTestDescription() { Result result = JUnitCore.runClasses(CuppaRunnerTest.ErroringTest.class); assertThat(result.getFailures()).hasSize(1); Failure failure = result.getFailures().get(0); assertThat(failure.getDescription().getDisplayName()) .isEqualTo("erroring test(org.forgerock.cuppa.junit.CuppaRunnerTest$ErroringTest)"); assertThat(failure.getException()).hasMessage("Test is bad").isInstanceOf(RuntimeException.class); }