SourceComparator implements ComparatorJob { @Override public final ComparatorStepResult compare() throws ProcessingException { try { return compareSources(); } catch (Exception ex) { throw new ProcessingException(ex.getMessage(), ex); } } SourceComparator(ArtifactsDAO artifactsDAO, ComparatorProperties properties,
      DiffParser diffParser, Sources sources); @Override void setParameters(final Map<String, String> params); @Override final ComparatorStepResult compare();  }
@Test public void testCompareOfValidInput() throws Exception { result = compare("pattern-source.html", "data-source.html", new HashMap<>()); assertEquals(ComparatorStepResult.Status.PASSED, result.getStatus()); assertFalse(result.isRebaseable()); assertEqualsToSavedArtifact("expected-result-with-sources.json"); }
@Test public void testCompareOfInvalidInput() throws Exception { result = compare("pattern-source.html", "data-invalid-source.html", new HashMap<>()); assertEquals(ComparatorStepResult.Status.FAILED, result.getStatus()); assertEqualsToSavedArtifact("expected-invalid-result.json"); }
@Test public void testCompareMarkupWithDifferentText() throws Exception { result = compare("markup/pattern-source.html", "markup/data-source.html", ImmutableMap.of("compareType", "markup")); assertEquals(ComparatorStepResult.Status.PASSED, result.getStatus()); }
@Test public void testCompareMarkupWithDifferentAttributeName() throws Exception { result = compare("markup/pattern-source.html", "markup/data-source-with-different-attribute-value.html", ImmutableMap.of("compareType", "markup")); assertEquals(ComparatorStepResult.Status.FAILED, result.getStatus()); }
@Test public void shouldRecognizeLineEndings() throws Exception { result = compare("formatting/empty-lines-windows.html", "formatting/empty-lines-linux.html", ImmutableMap.of("compareType", "all")); assertEquals(Status.FAILED, result.getStatus()); }
@Test public void shouldIgnoreLineEndingsForAllFormatted() throws Exception { result = compare("formatting/empty-lines-windows.html", "formatting/empty-lines-linux.html", ImmutableMap.of("compareType", "allformatted")); assertEquals(Status.PASSED, result.getStatus()); }
@Test public void shouldIgnoreWhitespacesForAllFormatted() throws Exception { result = compare("formatting/formatted.html", "formatting/not-formatted.html", ImmutableMap.of("compareType", "allformatted")); assertEquals(Status.PASSED, result.getStatus()); }