Mercurial > hg > ConflictEditor
changeset 19:97a113e27ed8
better assertions
author | dirk |
---|---|
date | Sat, 17 Sep 2011 07:10:23 +0200 |
parents | c621a437ace5 |
children | 9b10f33bcf90 |
files | conflict-editor/src/test/java/de/codedo/conflicteditor/DocumentMatcherTestCase.java |
diffstat | 1 files changed, 10 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/conflict-editor/src/test/java/de/codedo/conflicteditor/DocumentMatcherTestCase.java Sat Sep 17 07:05:41 2011 +0200 +++ b/conflict-editor/src/test/java/de/codedo/conflicteditor/DocumentMatcherTestCase.java Sat Sep 17 07:10:23 2011 +0200 @@ -1,12 +1,9 @@ package de.codedo.conflicteditor; -import static de.codedo.conflicteditor.matchers.ObjectEqualityMatcher.isEqualTo; import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasSize; -import static org.junit.Assert.assertEquals; import java.io.IOException; import java.util.List; @@ -33,12 +30,11 @@ JsonNode original = parse("{ 'key' : 'value' }"); JsonNode conflict = parse("{ 'key' : 'other-value' }"); List<Difference> diffs = new DocumentMatcher(original, conflict).compare(); - assertEquals(1, diffs.size()); + assertThat(diffs, hasSize(1)); - Difference diff = diffs.get(0); - assertEquals("key", diff.key); - assertEquals("value", diff.currentValue); - assertEquals("other-value", diff.otherValue); + Difference actualDifference = diffs.get(0); + Difference expectedDifference = new Difference("key", "value", "other-value"); + assertThat(actualDifference, is(expectedDifference)); } @Test @@ -49,10 +45,9 @@ List<Difference> diffs = new DocumentMatcher(original, conflict).compare(); assertThat(diffs, hasSize(1)); - Difference diff = diffs.get(0); - assertThat(diff.key, is("only-here")); - assertThat(diff.currentValue, isEqualTo("value")); - assertThat(diff.otherValue, is(nullValue())); + Difference actualDifference = diffs.get(0); + Difference expectedDifference = new Difference("only-here", "value", null); + assertThat(actualDifference, is(expectedDifference)); } @Test @@ -63,10 +58,9 @@ List<Difference> diffs = new DocumentMatcher(original, conflict).compare(); assertThat(diffs, hasSize(1)); - Difference diff = diffs.get(0); - assertThat(diff.key, is("only-here")); - assertThat(diff.currentValue, is(nullValue())); - assertThat(diff.otherValue, isEqualTo("value")); + Difference actualDifference = diffs.get(0); + Difference expectedDifference = new Difference("only-here", null, "value"); + assertThat(actualDifference, is(expectedDifference)); } private JsonNode parse(String input) throws IOException