public void after(Object testInstance, Method testMethod, LifecycleMethodExecutor executor) throws Exception { Validate.notNull(testInstance, "TestInstance must be specified"); Validate.notNull(testMethod, "TestMethod must be specified"); ExecutionDecision executionDecision = resolveExecutionDecision(manager, testMethod); if (executionDecision.getDecision() == Decision.DONT_EXECUTE) { return; } manager.fire(new After(testInstance, testMethod, executor)); }
private void executeTest(Object inspection, Method method, List<Annotation> qualifiers) { before.fire(new Before(inspection, method)); test.fire(new Test(new LifecycleMethodExecutor(inspection, method, qualifiers))); after.fire(new After(inspection, method)); }
@Test public void shouldInvokeAfterInContainerDeploymentContext() throws Exception { fire(new After(this, testMethod())); assertEventFiredInContext(After.class, ContainerContext.class); assertEventFiredInContext(After.class, DeploymentContext.class); }
@Test public void shouldInvokeAfterInContainerDeploymentContext() throws Exception { fire(new After(this, testMethod())); assertEventFiredInContext(After.class, ContainerContext.class); assertEventFiredInContext(After.class, DeploymentContext.class); }
@Test public void should_create_video_from_surefire_report_directory() throws NoSuchMethodException { //given TakeVncDroneVideo takeVncDroneVideo = new TakeVncDroneVideo(); takeVncDroneVideo.reportEvent = reportEvent; final Method method = getMethod("should_create_video_from_surefire_report_directory"); AfterVideoRecorded afterVideoRecorded = new AfterVideoRecorded(new After(TakeDockerEnvironmentTest.class, method), Paths.get("target/surefire-report/myvideo.flv")); //when takeVncDroneVideo.reportScreencastRecording(afterVideoRecorded, getReporterConfiguration()); //then verify(reportEvent).fire(reportEventArgumentCaptor.capture()); final SectionEvent sectionEvent = reportEventArgumentCaptor.getValue(); final String methodName = method.getName(); assertThatSection(sectionEvent) .hasSectionId(methodName) .hasReportOfTypeThatIsAssignableFrom(TestMethodReport.class); final Report report = sectionEvent.getReport(); assertThatReport(report) .hasName(methodName) .hasNumberOfEntries(1) .hasEntriesContaining(new KeyValueEntry(DockerEnvironmentReportKey.VIDEO_PATH, new FileEntry("surefire-report/myvideo.mp4"))); }
@Test public void should_create_video_from_root_directory() throws NoSuchMethodException { //given TakeVncDroneVideo takeVncDroneVideo = new TakeVncDroneVideo(); takeVncDroneVideo.reportEvent = reportEvent; final Method method = getMethod("should_create_video_from_root_directory"); AfterVideoRecorded afterVideoRecorded = new AfterVideoRecorded(new After(TakeDockerEnvironmentTest.class, method), Paths.get("target/myvideo.flv")); //when takeVncDroneVideo.reportScreencastRecording(afterVideoRecorded, getReporterConfiguration()); //then verify(reportEvent).fire(reportEventArgumentCaptor.capture()); final SectionEvent sectionEvent = reportEventArgumentCaptor.getValue(); final String methodName = method.getName(); assertThatSection(sectionEvent) .hasSectionId(methodName) .hasReportOfTypeThatIsAssignableFrom(TestMethodReport.class); final Report report = sectionEvent.getReport(); assertThatReport(report) .hasName(methodName) .hasNumberOfEntries(1) .hasEntriesContaining(new KeyValueEntry(DockerEnvironmentReportKey.VIDEO_PATH, new FileEntry("myvideo.mp4"))); }