Skip to content

Commit 86f13c8

Browse files
committed
fix some nits
1 parent 9d48dad commit 86f13c8

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

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

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -189,17 +189,17 @@ void testGetHistoryPartial() throws Exception {
189189
* @param args {@code hg} command arguments
190190
*/
191191
public static void runHgCommand(File reposRoot, String... args) {
192-
List<String> cmdargs = new ArrayList<>();
192+
List<String> commandWithArgs = new ArrayList<>();
193193
MercurialRepository repo = new MercurialRepository();
194194

195-
cmdargs.add(repo.getRepoCommand());
196-
cmdargs.addAll(Arrays.asList(args));
195+
commandWithArgs.add(repo.getRepoCommand());
196+
commandWithArgs.addAll(Arrays.asList(args));
197197

198-
Map<String, String> env = new HashMap<>();
199-
env.put("HGUSER", "foo <foo@example.com>");
200-
Executor exec = new Executor(cmdargs, reposRoot, env);
198+
final Map<String, String> env = new HashMap<>();
199+
env.put("HGUSER", "Snufkin <snufkin@example.com>");
200+
Executor exec = new Executor(commandWithArgs, reposRoot, env);
201201
int exitCode = exec.exec();
202-
assertEquals(0, exitCode, "hg command '" + cmdargs + "' failed."
202+
assertEquals(0, exitCode, "command '" + commandWithArgs + "' failed."
203203
+ "\nexit code: " + exitCode
204204
+ "\nstdout:\n" + exec.getOutputString()
205205
+ "\nstderr:\n" + exec.getErrorString());
@@ -303,10 +303,7 @@ void testGetHistoryGetRenamed() throws Exception {
303303
String exp_str = "This is totally plaintext file.\n";
304304
byte[] buffer = new byte[1024];
305305

306-
/*
307-
* In our test repository the file was renamed twice since
308-
* revision 3.
309-
*/
306+
// In our test repository the file was renamed twice since revision 3.
310307
InputStream input = mr.getHistoryGet(repositoryRoot.getCanonicalPath(),
311308
"novel.txt", "3");
312309
assertNotNull(input);
@@ -354,8 +351,7 @@ void testGetHistorySinceTillNullRev() throws Exception {
354351
assertNotNull(history);
355352
assertNotNull(history.getHistoryEntries());
356353
assertEquals(6, history.getHistoryEntries().size());
357-
List<String> revisions = history.getHistoryEntries().stream().map(HistoryEntry::getRevision).
358-
collect(Collectors.toList());
354+
List<String> revisions = history.getHistoryEntries().stream().map(HistoryEntry::getRevision).toList();
359355
assertEquals(List.of(Arrays.copyOfRange(REVISIONS, 4, REVISIONS.length)), revisions);
360356
}
361357

@@ -366,8 +362,7 @@ void testGetHistorySinceTillRevNull() throws Exception {
366362
assertNotNull(history);
367363
assertNotNull(history.getHistoryEntries());
368364
assertEquals(3, history.getHistoryEntries().size());
369-
List<String> revisions = history.getHistoryEntries().stream().map(HistoryEntry::getRevision).
370-
collect(Collectors.toList());
365+
List<String> revisions = history.getHistoryEntries().stream().map(HistoryEntry::getRevision).toList();
371366
assertEquals(List.of(Arrays.copyOfRange(REVISIONS, 0, 3)), revisions);
372367
}
373368

@@ -378,8 +373,7 @@ void testGetHistorySinceTillRevRev() throws Exception {
378373
assertNotNull(history);
379374
assertNotNull(history.getHistoryEntries());
380375
assertEquals(5, history.getHistoryEntries().size());
381-
List<String> revisions = history.getHistoryEntries().stream().map(HistoryEntry::getRevision).
382-
collect(Collectors.toList());
376+
List<String> revisions = history.getHistoryEntries().stream().map(HistoryEntry::getRevision).toList();
383377
assertEquals(List.of(Arrays.copyOfRange(REVISIONS, 2, 7)), revisions);
384378
}
385379

@@ -393,8 +387,7 @@ void testGetHistoryRenamedFileTillRev() throws Exception {
393387
assertNotNull(history);
394388
assertNotNull(history.getHistoryEntries());
395389
assertEquals(5, history.getHistoryEntries().size());
396-
List<String> revisions = history.getHistoryEntries().stream().map(HistoryEntry::getRevision).
397-
collect(Collectors.toList());
390+
List<String> revisions = history.getHistoryEntries().stream().map(HistoryEntry::getRevision).toList();
398391
assertEquals(List.of(Arrays.copyOfRange(REVISIONS, 2, 7)), revisions);
399392
}
400393

@@ -447,8 +440,10 @@ void testAnnotationNegative() throws Exception {
447440
}
448441

449442
private static Stream<Triple<String, List<String>, List<String>>> provideParametersForPositiveAnnotationTest() {
450-
return Stream.of(Triple.of("8:6a8c423f5624", List.of("7", "8"), List.of("8:6a8c423f5624", "7:db1394c05268")),
451-
Triple.of("7:db1394c05268", List.of("7"), List.of("7:db1394c05268")));
443+
return Stream.of(
444+
Triple.of("8:6a8c423f5624", List.of("7", "8"), List.of("8:6a8c423f5624", "7:db1394c05268")),
445+
Triple.of("7:db1394c05268", List.of("7"), List.of("7:db1394c05268"))
446+
);
452447
}
453448

454449
@ParameterizedTest
@@ -583,7 +578,7 @@ void testBuildTagListOneMore() throws Exception {
583578
assertNotNull(tags);
584579
assertEquals(3, tags.size());
585580
expectedTags = List.of("start_of_novel", newTagName, branchTagName);
586-
assertEquals(expectedTags, tags.stream().map(TagEntry::getTags).collect(Collectors.toList()));
581+
assertEquals(expectedTags, tags.stream().map(TagEntry::getTags).toList());
587582

588583
// cleanup
589584
IOUtils.removeRecursive(repositoryRootPath);

0 commit comments

Comments
 (0)