Skip to content

Commit 51e6953

Browse files
vladakahornace
authored andcommitted
refactor to avoid multiple exceptions in single lambda
1 parent c5f0464 commit 51e6953

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ void testAnnotationOfRenamedFilePastWithHandlingOn() throws Exception {
381381
}
382382

383383
@Test
384-
void testInvalidRenamedFiles() {
384+
void testInvalidRenamedFiles() throws Exception {
385385
String[][] tests = new String[][] {
386386
{"", "67dfbe26"},
387387
{"moved/renamed2.c", ""},
@@ -390,14 +390,13 @@ void testInvalidRenamedFiles() {
390390
{"moved/renamed2.c", null}
391391

392392
};
393+
File root = new File(repository.getSourceRoot(), "git");
394+
GitRepository gitRepository = (GitRepository) RepositoryFactory.getRepository(root);
393395
assertThrows(IOException.class, () -> {
394-
File root = new File(repository.getSourceRoot(), "git");
395-
GitRepository gitrepo = (GitRepository) RepositoryFactory.getRepository(root);
396-
397396
for (String[] test : tests) {
398397
String file = test[0];
399398
String changeset = test[1];
400-
gitrepo.findOriginalName(file, changeset);
399+
gitRepository.findOriginalName(file, changeset);
401400
}
402401
});
403402
}

0 commit comments

Comments
 (0)