27
27
import org .junit .jupiter .api .BeforeAll ;
28
28
import org .junit .jupiter .api .Test ;
29
29
import org .opengrok .indexer .configuration .RuntimeEnvironment ;
30
- import org .opengrok .indexer .history .HistoryGuru ;
31
30
import org .opengrok .indexer .history .RepositoryFactory ;
32
31
import org .opengrok .indexer .index .Indexer ;
33
32
import org .opengrok .indexer .util .TestRepository ;
34
33
import org .opengrok .indexer .web .QueryParameters ;
35
34
36
35
import static org .junit .jupiter .api .Assertions .assertAll ;
37
36
import static org .junit .jupiter .api .Assertions .assertEquals ;
37
+ import static org .junit .jupiter .api .Assertions .assertFalse ;
38
38
import static org .junit .jupiter .api .Assertions .assertNotNull ;
39
39
import static org .junit .jupiter .api .Assertions .assertNull ;
40
40
import static org .junit .jupiter .api .Assertions .assertTrue ;
@@ -50,7 +50,7 @@ class DiffTest {
50
50
@ BeforeAll
51
51
static void setUp () throws Exception {
52
52
repository = new TestRepository ();
53
- repository .create (HistoryGuru .class .getResource ("/repositories" ));
53
+ repository .create (DiffTest .class .getResource ("/repositories" ));
54
54
55
55
env .setSourceRoot (repository .getSourceRoot ());
56
56
env .setDataRoot (repository .getDataRoot ());
@@ -98,6 +98,12 @@ void testGetDiffDataInvalidRevision() {
98
98
assertNotNull (diffData );
99
99
assertNotNull (diffData .getErrorMsg ());
100
100
assertTrue (diffData .getErrorMsg ().startsWith ("Unable to get revision" ));
101
+ assertAll (
102
+ () -> assertNull (diffData .getRevision ()),
103
+ () -> assertNull (diffData .getParam (0 )),
104
+ () -> assertNull (diffData .getParam (1 )),
105
+ () -> assertNull (diffData .getType ())
106
+ );
101
107
}
102
108
103
109
@ Test
@@ -119,7 +125,12 @@ void testGetDiffData() {
119
125
assertAll (() -> assertEquals (rev1 , diffData .getRev (0 )),
120
126
() -> assertEquals (rev2 , diffData .getRev (1 )),
121
127
() -> assertTrue (diffData .getFile (0 ).length > 0 ),
122
- () -> assertTrue (diffData .getFile (1 ).length > 0 )
128
+ () -> assertTrue (diffData .getFile (1 ).length > 0 ),
129
+ () -> assertNotNull (diffData .getRevision ()),
130
+ () -> assertEquals ("/git/main.c@bb74b7e" , diffData .getParam (0 )),
131
+ () -> assertEquals ("/git/main.c@aa35c25" , diffData .getParam (1 )),
132
+ () -> assertEquals (DiffType .SIDEBYSIDE , diffData .getType ()),
133
+ () -> assertFalse (diffData .isFull ())
123
134
);
124
135
}
125
136
}
0 commit comments