18
18
*/
19
19
20
20
/*
21
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
21
+ * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
22
22
*/
23
23
package org .opengrok .indexer .history ;
24
24
@@ -65,7 +65,7 @@ void testEqualsNegativeFileName() {
65
65
* {@link AnnotationData} with different lists of {@link AnnotationLine} should differ.
66
66
*/
67
67
@ Test
68
- void testEqualsNegative () {
68
+ void testEqualsNegativeLineLists () {
69
69
final AnnotationLine annotationLine1 = new AnnotationLine ("1.0" , "Me" , true );
70
70
final AnnotationLine annotationLine2 = new AnnotationLine ("1.1" , "Me" , true );
71
71
final AnnotationLine annotationLine3 = new AnnotationLine ("1.2" , "Me" , true );
@@ -76,9 +76,31 @@ void testEqualsNegative() {
76
76
annotationData1 .addLine (annotationLine3 );
77
77
78
78
AnnotationData annotationData2 = new AnnotationData ();
79
+ annotationData2 .addLine (annotationLine1 );
80
+ annotationData2 .addLine (annotationLine2 );
81
+
82
+ assertNotEquals (annotationData1 , annotationData2 );
83
+ }
84
+
85
+ /**
86
+ * This is useful for {@link FileAnnotationCacheTest#testSerialization()}.
87
+ * {@link AnnotationData} with non-equal {@link AnnotationLine}s should differ.
88
+ */
89
+ @ Test
90
+ void testEqualsNegativeLineContents () {
91
+ final AnnotationLine annotationLine1 = new AnnotationLine ("1.0" , "Me" , true , "10" );
92
+ final AnnotationLine annotationLine2 = new AnnotationLine ("1.1" , "Me" , true , "11" );
93
+
94
+ AnnotationData annotationData1 = new AnnotationData ();
79
95
annotationData1 .addLine (annotationLine1 );
80
96
annotationData1 .addLine (annotationLine2 );
81
97
98
+ AnnotationData annotationData2 = new AnnotationData ();
99
+ annotationData2 .addLine (annotationLine1 );
100
+ final AnnotationLine annotationLine2changed = new AnnotationLine ("1.1" , "Me" , true , "111" );
101
+ assertNotEquals (annotationLine2 , annotationLine2changed );
102
+ annotationData2 .addLine (annotationLine2changed );
103
+
82
104
assertNotEquals (annotationData1 , annotationData2 );
83
105
}
84
106
0 commit comments