Skip to content

Commit 262726b

Browse files
committed
test getDesc()
1 parent 7a3b65f commit 262726b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
package org.opengrok.indexer.history;
2727

2828
import org.jetbrains.annotations.TestOnly;
29+
import org.jetbrains.annotations.VisibleForTesting;
2930
import org.opengrok.indexer.logger.LoggerFactory;
3031
import org.opengrok.indexer.util.Color;
3132
import org.opengrok.indexer.util.LazilyInstantiate;
@@ -166,7 +167,8 @@ public boolean isEnabled(int line) {
166167
return annotationData.isEnabled(line);
167168
}
168169

169-
void addDesc(String revision, String description) {
170+
@VisibleForTesting
171+
public void addDesc(String revision, String description) {
170172
desc.put(revision, description);
171173
}
172174

opengrok-indexer/src/test/java/org/opengrok/indexer/web/UtilTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -702,15 +702,17 @@ void testWriteHAD() throws Exception {
702702
void testWriteAnnotation(boolean enabled) throws IOException {
703703
StringWriter writer = new StringWriter();
704704
AnnotationData annotationData = new AnnotationData();
705-
annotationData.addLine("rev", "author", enabled, "dispRev");
705+
final String rev = "rev";
706+
annotationData.addLine(rev, "author", enabled, "dispRev");
706707
Annotation annotation = new Annotation(annotationData);
708+
annotation.addDesc(rev, "description");
707709
Util.writeAnnotation(1, writer, annotation, null, null, "foo");
708710
String output = writer.toString();
709711
String expectedOutput;
710712
if (enabled) {
711713
expectedOutput = "<span class=\"blame\">" +
712714
"<a class=\"r title-tooltip\" style=\"background-color: rgb(255, 191, 195)\" " +
713-
"href=\"?a=true&amp;r=rev\" title=\"\">dispRev</a>" +
715+
"href=\"?a=true&amp;r=rev\" title=\"description\">dispRev</a>" +
714716
"<a class=\"search\" href=\"/source/s?defs=&amp;refs=&amp;path=foo&amp;hist=&quot;rev&quot;&amp;type=\" " +
715717
"title=\"Search history for this revision\">S</a><span class=\"a\">author</span></span>";
716718
} else {

0 commit comments

Comments
 (0)