Skip to content

Commit d1b4ed4

Browse files
harrisricvladak
authored andcommitted
Reinstate simple constructor for AnnotationLine
1 parent 47f0baa commit d1b4ed4

File tree

3 files changed

+27
-17
lines changed

3 files changed

+27
-17
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/history/AnnotationLine.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ public AnnotationLine() {
4747
// for serialization
4848
}
4949

50+
/**
51+
* An annotation line where the revision is not overridden for display purposes.
52+
* @param revision
53+
* @param author
54+
* @param enabled
55+
*/
56+
AnnotationLine(String revision, String author, boolean enabled) {
57+
this(revision, author, enabled, null);
58+
}
59+
5060
AnnotationLine(String revision, String author, boolean enabled, String displayRevision) {
5161
this.revision = revision == null ? "" : revision;
5262
this.author = author == null ? "" : author;

opengrok-indexer/src/test/java/org/opengrok/indexer/history/AnnotationDataTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ void testEqualsNegativeFileName() {
6666
*/
6767
@Test
6868
void testEqualsNegative() {
69-
final AnnotationLine annotationLine1 = new AnnotationLine("1.0", "Me", true, null);
70-
final AnnotationLine annotationLine2 = new AnnotationLine("1.1", "Me", true, null);
71-
final AnnotationLine annotationLine3 = new AnnotationLine("1.2", "Me", true, null);
69+
final AnnotationLine annotationLine1 = new AnnotationLine("1.0", "Me", true);
70+
final AnnotationLine annotationLine2 = new AnnotationLine("1.1", "Me", true);
71+
final AnnotationLine annotationLine3 = new AnnotationLine("1.2", "Me", true);
7272

7373
AnnotationData annotationData1 = new AnnotationData();
7474
annotationData1.addLine(annotationLine1);
@@ -88,8 +88,8 @@ void testEqualsNegative() {
8888
*/
8989
@Test
9090
void testEqualsNegativeStoredRevision() {
91-
final AnnotationLine annotationLine1 = new AnnotationLine("1.0", "Me", true, null);
92-
final AnnotationLine annotationLine2 = new AnnotationLine("1.1", "Me", true, null);
91+
final AnnotationLine annotationLine1 = new AnnotationLine("1.0", "Me", true);
92+
final AnnotationLine annotationLine2 = new AnnotationLine("1.1", "Me", true);
9393

9494
AnnotationData annotationData1 = new AnnotationData();
9595
annotationData1.addLine(annotationLine1);
@@ -111,9 +111,9 @@ void testEqualsNegativeStoredRevision() {
111111
@Test
112112
void testEqualsPositive() {
113113
final String fileName = "foo.txt";
114-
final AnnotationLine annotationLine1 = new AnnotationLine("1.0", "Me", true, null);
115-
final AnnotationLine annotationLine2 = new AnnotationLine("1.1", "Me", true, null);
116-
final AnnotationLine annotationLine3 = new AnnotationLine("1.2", "Me", true, null);
114+
final AnnotationLine annotationLine1 = new AnnotationLine("1.0", "Me", true);
115+
final AnnotationLine annotationLine2 = new AnnotationLine("1.1", "Me", true);
116+
final AnnotationLine annotationLine3 = new AnnotationLine("1.2", "Me", true);
117117

118118
AnnotationData annotationData1 = new AnnotationData(fileName);
119119
annotationData1.addLine(annotationLine1);

opengrok-indexer/src/test/java/org/opengrok/indexer/history/AnnotationLineTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ class AnnotationLineTest {
3737
*/
3838
@Test
3939
void testEqualsNegative1() {
40-
AnnotationLine annotationLine1 = new AnnotationLine("1.0", "bar", true, null);
41-
AnnotationLine annotationLine2 = new AnnotationLine("1.0", "barX", true, null);
40+
AnnotationLine annotationLine1 = new AnnotationLine("1.0", "bar", true);
41+
AnnotationLine annotationLine2 = new AnnotationLine("1.0", "barX", true);
4242
assertNotEquals(annotationLine1, annotationLine2);
4343
}
4444

@@ -47,8 +47,8 @@ void testEqualsNegative1() {
4747
*/
4848
@Test
4949
void testEqualsNegative2() {
50-
AnnotationLine annotationLine1 = new AnnotationLine("1.0.1", "bar", true, null);
51-
AnnotationLine annotationLine2 = new AnnotationLine("1.0", "bar", true, null);
50+
AnnotationLine annotationLine1 = new AnnotationLine("1.0.1", "bar", true);
51+
AnnotationLine annotationLine2 = new AnnotationLine("1.0", "bar", true);
5252
assertNotEquals(annotationLine1, annotationLine2);
5353
}
5454

@@ -57,8 +57,8 @@ void testEqualsNegative2() {
5757
*/
5858
@Test
5959
void testEqualsNegative3() {
60-
AnnotationLine annotationLine1 = new AnnotationLine("1.0", "bar", true, null);
61-
AnnotationLine annotationLine2 = new AnnotationLine("1.0", "bar", false, null);
60+
AnnotationLine annotationLine1 = new AnnotationLine("1.0", "bar", true);
61+
AnnotationLine annotationLine2 = new AnnotationLine("1.0", "bar", false);
6262
assertNotEquals(annotationLine1, annotationLine2);
6363
}
6464

@@ -67,8 +67,8 @@ void testEqualsNegative3() {
6767
*/
6868
@Test
6969
void testEqualsPositive() {
70-
AnnotationLine annotationLine1 = new AnnotationLine("1.0", "bar", true, null);
71-
AnnotationLine annotationLine2 = new AnnotationLine("1.0", "bar", true, null);
70+
AnnotationLine annotationLine1 = new AnnotationLine("1.0", "bar", true);
71+
AnnotationLine annotationLine2 = new AnnotationLine("1.0", "bar", true);
7272
assertEquals(annotationLine1, annotationLine2);
7373
}
7474

@@ -77,7 +77,7 @@ void testEqualsPositive() {
7777
*/
7878
@Test
7979
void testDisplayRevisionFallBack() {
80-
AnnotationLine annotationLine1 = new AnnotationLine("1.0", "bar", true, null);
80+
AnnotationLine annotationLine1 = new AnnotationLine("1.0", "bar", true);
8181
assertEquals("1.0", annotationLine1.getDisplayRevision());
8282
}
8383

0 commit comments

Comments
 (0)