X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Ftestutils%2FAnnotationsMatcherTest.java;h=3fbdab68bdf8abbd7c30755389c0e69490a3561b;hb=614e136583b401b4273d92723fec158d84d4cb52;hp=732329bbe0c2c3c6492efbd9ca6b3791e12812de;hpb=2ea710eca2128ed962434e668bbf51180b6ceab8;p=jalview.git diff --git a/test/jalview/testutils/AnnotationsMatcherTest.java b/test/jalview/testutils/AnnotationsMatcherTest.java index 732329b..3fbdab6 100644 --- a/test/jalview/testutils/AnnotationsMatcherTest.java +++ b/test/jalview/testutils/AnnotationsMatcherTest.java @@ -48,7 +48,10 @@ public class AnnotationsMatcherTest new Annotation[] { Annotation.EMPTY_ANNOTATION, Annotation.EMPTY_ANNOTATION }, new Annotation[] { - Annotation.EMPTY_ANNOTATION, Annotation.EMPTY_ANNOTATION } } }; + Annotation.EMPTY_ANNOTATION, Annotation.EMPTY_ANNOTATION } }, + { + new Annotation[] { null, null, null, null }, + new Annotation[] { null, null, null, null } } }; } @Test(groups = { "Functional" }, dataProvider = "matchingAnnotationsLists") @@ -80,7 +83,9 @@ public class AnnotationsMatcherTest new Annotation(null, null, ' ', 0.0f) }, { new Annotation(null, "", ' ', 0.0f), - new Annotation("", null, ' ', 0.0f) } }; + new Annotation("", null, ' ', 0.0f) }, + { new Annotation(0f), Annotation.EMPTY_ANNOTATION }, + { new Annotation(1f), new Annotation("", "", ' ', 1f, null) }, }; } @Test(groups = { "Functional" }, dataProvider = "matchingAnnotations") @@ -90,6 +95,39 @@ public class AnnotationsMatcherTest assert AnnotationsMatcher.annotationsEqual(first, second); } + @DataProvider + public Object[][] mismatchingAnnotations() + { + return new Object[][] { + { + new Annotation("A", "aaa", 'A', 1f), + new Annotation("A", "aaa", 'B', 1f) }, + { new Annotation(1f), new Annotation(2f) }, + { new Annotation(1f), new Annotation("A", "", 'A', 1f) } }; + } + + @Test(groups = { "Functional" }, dataProvider = "mismatchingAnnotations") + public void testAnnotationsEqual_mismatchingAnnotations(Annotation first, + Annotation second) + { + assert !AnnotationsMatcher.annotationsEqual(first, second); + } + + @Test(groups = { "Functional" }) + public void testAnnotationsEqual_nullsMatch() + { + assert AnnotationsMatcher.annotationsEqual(null, null); + } + + @Test(groups = { "Functional" }) + public void testAnnotationsEqual_nullNotMatchEmpty() + { + assert !AnnotationsMatcher + .annotationsEqual(null, Annotation.EMPTY_ANNOTATION); + assert !AnnotationsMatcher + .annotationsEqual(Annotation.EMPTY_ANNOTATION, null); + } + @Test(groups = { "Functional" }) public void testAnnotationsEqual_compareNullDisplayCharToEmpty() {