18
18
*/
19
19
20
20
/*
21
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
21
+ * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
22
22
*/
23
23
package org .opengrok .indexer .history ;
24
24
35
35
import static org .junit .jupiter .api .Assertions .assertEquals ;
36
36
import static org .junit .jupiter .api .Assertions .assertFalse ;
37
37
import static org .junit .jupiter .api .Assertions .assertNotEquals ;
38
+ import static org .junit .jupiter .api .Assertions .assertNull ;
38
39
import static org .junit .jupiter .api .Assertions .assertTrue ;
39
40
40
- public class HistoryTest {
41
+ class HistoryTest {
41
42
private final List <HistoryEntry > entries = List .of (
42
43
new HistoryEntry ("84599b3c" , new Date (1485438707000L ),
43
44
"Kryštof Tulinger <[email protected] >" ,
null ,
@@ -49,7 +50,7 @@ public class HistoryTest {
49
50
Set .of (File .separator + Paths .get ("git" , "moved" , "renamed2.c" ))));
50
51
51
52
@ Test
52
- public void testEqualsRenamed () {
53
+ void testEqualsRenamed () {
53
54
History history = new History (entries ,
54
55
List .of (Paths .get ("moved" , "renamed2.c" ).toString (),
55
56
Paths .get ("moved2" , "renamed2.c" ).toString (),
@@ -59,7 +60,7 @@ public void testEqualsRenamed() {
59
60
}
60
61
61
62
@ Test
62
- public void testEquals () {
63
+ void testEquals () {
63
64
History history = new History (entries );
64
65
assertEquals (2 , history .getHistoryEntries ().size ());
65
66
History historySmaller = new History (entries .subList (1 , 2 ));
@@ -115,4 +116,16 @@ void testEqualsTagsNegative() {
115
116
history2 .setTags (Map .of ("foo" , "bar" , "bar" , "foo" ));
116
117
assertNotEquals (history1 , history2 );
117
118
}
119
+
120
+ @ Test
121
+ void testGetLastHistoryEntryEmpty () {
122
+ History history = new History ();
123
+ assertNull (history .getLastHistoryEntry ());
124
+ }
125
+
126
+ @ Test
127
+ void testGetLastHistoryEntry () {
128
+ History history = new History (entries );
129
+ assertEquals (entries .get (0 ), history .getLastHistoryEntry ());
130
+ }
118
131
}
0 commit comments