Repository navigation
Expand file tree
/
Copy pathOutputBuilderTest.java
More file actions
77 lines (62 loc) · 2.32 KB
/
Copy pathOutputBuilderTest.java
File metadata and controls
77 lines (62 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package analyzer;
import analyzer.comments.ExemplarSolution;
import analyzer.test.FakeComment;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
class OutputBuilderTest {
private OutputBuilder builder;
@BeforeEach
void setup() {
builder = new OutputBuilder();
}
@Test
@DisplayName("Unable to add duplicate comments")
void testDuplicateComments() {
var comment = new ExemplarSolution("hello-world");
builder.addComment(comment);
builder.addComment(comment);
var output = builder.build();
assertThat(output.analysis().comments()).containsExactly(comment);
}
@Test
@DisplayName("Unable to add duplicate tags")
void testDuplicateTags() {
var tag = "concept:inheritance";
builder.addTag(tag);
builder.addTag(tag);
var output = builder.build();
assertThat(output.tags().tags()).containsExactly(tag);
}
@Test
@DisplayName("Summary can be overwritten")
void testOverwriteSummary() {
builder.setSummary("Initial summary");
builder.setSummary("Second summary");
var output = builder.build();
assertThat(output.analysis().summary()).isEqualTo("Second summary");
}
@Test
@DisplayName("Summary can be cleared")
void testClearSummary() {
builder.setSummary("Initial summary");
builder.setSummary(null);
var output = builder.build();
assertThat(output.analysis().summary()).isNull();
}
@Test
@DisplayName("Analysis comments are ordered by type")
void testCommentOrder() {
var essential = new FakeComment().withType(Comment.Type.ESSENTIAL);
var actionable = new FakeComment().withType(Comment.Type.ACTIONABLE);
var informative = new FakeComment().withType(Comment.Type.INFORMATIVE);
var celebratory = new FakeComment().withType(Comment.Type.CELEBRATORY);
builder.addComment(celebratory);
builder.addComment(actionable);
builder.addComment(informative);
builder.addComment(essential);
var output = builder.build();
assertThat(output.analysis().comments()).containsExactly(essential, actionable, informative, celebratory);
}
}