@@ -0,0 +1,2938 @@
+package de.retest.recheck.ui.review;%0A%0Aimport static org.assertj.core.api.Assertions.assertThat;%0Aimport static org.assertj.core.api.Assertions.assertThatCode;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when;%0A%0Aimport java.util.Arrays;%0A%0Aimport org.junit.jupiter.api.BeforeEach;%0Aimport org.junit.jupiter.api.Test;%0A%0Aimport de.retest.recheck.report.ActionReplayResult;%0Aimport de.retest.recheck.ui.descriptors.IdentifyingAttributes;%0Aimport de.retest.recheck.ui.diff.ElementDifference;%0Aimport de.retest.recheck.ui.diff.RootElementDifference;%0Aimport de.retest.recheck.ui.diff.StateDifference;%0Aimport de.retest.recheck.ui.image.Screenshot;%0A%0Aclass ScreenshotChangesTest %7B%0A%0A%09ActionReplayResult actionReplayResult;%0A%0A%09Screenshot screenshot;%0A%0A%09IdentifyingAttributes identifyingForPresentScreenshot;%0A%09IdentifyingAttributes identifyingForMissingScreenshot;%0A%0A%09@BeforeEach%0A%09void setUp() %7B%0A%09%09screenshot = mock( Screenshot.class );%0A%09%09identifyingForPresentScreenshot = mock( IdentifyingAttributes.class );%0A%09%09identifyingForMissingScreenshot = mock( IdentifyingAttributes.class );%0A%0A%09%09final ElementDifference elementWithScreenshot = mock( ElementDifference.class );%0A%09%09when( elementWithScreenshot.getIdentifyingAttributes() ).thenReturn( identifyingForPresentScreenshot );%0A%09%09when( elementWithScreenshot.getActualScreenshot() ).thenReturn( screenshot );%0A%0A%09%09final RootElementDifference rootElementWithScreenshot = mock( RootElementDifference.class );%0A%09%09when( rootElementWithScreenshot.getElementDifference() ).thenReturn( elementWithScreenshot );%0A%09%09when( rootElementWithScreenshot.getActualScreenshot() ).thenReturn( screenshot );%0A%0A%09%09final ElementDifference elementWithoutScreenshot = mock( ElementDifference.class );%0A%09%09when( elementWithoutScreenshot.getIdentifyingAttributes() ).thenReturn( identifyingForMissingScreenshot );%0A%0A%09%09final RootElementDifference rootElementWithoutScreenshot = mock( RootElementDifference.class );%0A%09%09when( rootElementWithoutScreenshot.getElementDifference() ).thenReturn( elementWithoutScreenshot );%0A%0A%09%09final StateDifference stateDifference = mock( StateDifference.class );%0A%09%09when( stateDifference.getRootElementDifferences() )%0A%09%09%09%09.thenReturn( Arrays.asList( rootElementWithScreenshot, rootElementWithoutScreenshot ) );%0A%0A%09%09actionReplayResult = mock( ActionReplayResult.class );%0A%09%09when( actionReplayResult.getStateDifference() ).thenReturn( stateDifference );%0A%09%7D%0A%0A%09@Test%0A%09void actual_should_properly_lookup_element_screenshots() throws Exception %7B%0A%09%09final ScreenshotChanges cut = ScreenshotChanges.actual( actionReplayResult );%0A%0A%09%09assertThat( cut.getScreenshot( identifyingForPresentScreenshot ) ).isEqualTo( screenshot );%0A%09%09assertThat( cut.getScreenshot( identifyingForMissingScreenshot ) ).isNull();%0A%09%7D%0A%0A%09@Test%0A%09void actual_should_not_produce_null_pointer_with_null_screenshots() throws Exception %7B%0A%09%09assertThatCode( () -%3E ScreenshotChanges.actual( actionReplayResult ) ).doesNotThrowAnyException();%0A%09%7D%0A%7D%0A

Create test with missing screenshot