@@ -0,0 +1,2366 @@
+package de.retest.recheck.ui.diff;%0A%0Aimport static org.assertj.core.api.Assertions.assertThat;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when;%0A%0Aimport java.awt.image.BufferedImage;%0Aimport java.util.ArrayList;%0Aimport java.util.Collections;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport de.retest.recheck.image.ImageDifference;%0Aimport de.retest.recheck.image.ImageDifferenceCalculator;%0Aimport de.retest.recheck.ui.descriptors.Element;%0Aimport de.retest.recheck.ui.descriptors.IdentifyingAttributes;%0Aimport de.retest.recheck.ui.descriptors.RootElement;%0Aimport de.retest.recheck.ui.descriptors.ScreenshotAttributeDifference;%0Aimport de.retest.recheck.ui.image.Screenshot;%0A%0Apublic class RootElementDifferenceTest %7B%0A%0A%09RootElementDifference cut;%0A%0A%09@Before%0A%09public void setup() %7B%0A%09%09final Screenshot expected = mock( Screenshot.class );%0A%09%09final Screenshot actual = mock( Screenshot.class );%0A%09%09final AttributeDifference screenshotDiff = new ScreenshotAttributeDifference( expected, actual,%0A%09%09%09%09TestImageDifferenceCalculator.class.getName(), 0.99 );%0A%09%09final AttributesDifference attributesDiff =%0A%09%09%09%09new AttributesDifference( Collections.singletonList( screenshotDiff ) );%0A%09%09final Element eleme = mock( Element.class );%0A%09%09when( eleme.getIdentifyingAttributes() ).thenReturn( mock( IdentifyingAttributes.class ) );%0A%09%09final ElementDifference elementDifference = new ElementDifference( eleme, attributesDiff,%0A%09%09%09%09mock( IdentifyingAttributesDifference.class ), expected, actual, new ArrayList%3C%3E() );%0A%09%09cut = new RootElementDifference( elementDifference, mock( RootElement.class ), mock( RootElement.class ) );%0A%09%7D%0A%0A%09@Test%0A%09public void getScreenshotDifference_should_find_difference() %7B%0A%09%09assertThat( cut.getScreenshotDifference() ).isNotNull();%0A%09%7D%0A%0A%09@Test%0A%09public void getExpectedScreenshot_should_recalc_diff() throws Exception %7B%0A%09%09// image2Screenshot will return null instead of mocked screenshot.%0A%09%09assertThat( cut.getExpectedScreenshot() ).isNull();%0A%09%7D%0A%0A%09static class TestImageDifferenceCalculator implements ImageDifferenceCalculator %7B%0A%0A%09%09@Override%0A%09%09public ImageDifference compare( final BufferedImage img1, final BufferedImage img2 ) %7B%0A%09%09%09return mock( ImageDifference.class );%0A%09%09%7D%0A%0A%09%09@Override%0A%09%09public ImageDifference compare( final Screenshot expected, final Screenshot actual ) %7B%0A%09%09%09return mock( ImageDifference.class );%0A%09%09%7D%0A%0A%09%7D%0A%0A%7D%0A

Move tests for RootElementDifference from review