Skip to content

Commit a4a222e

Browse files
committed
add asserts for Git operations
1 parent 9cfb33d commit a4a222e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

opengrok-indexer/src/test/java/org/opengrok/indexer/index/IndexDatabaseTest.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,15 +358,20 @@ private void changeGitRepository(File repositoryRoot) throws Exception {
358358
assertTrue(rmFile.exists());
359359
git.rm().addFilepattern("main.o").call();
360360
git.commit().setMessage("delete").setAuthor("foo", "[email protected]").setAll(true).call();
361+
assertFalse(rmFile.exists());
361362

362363
// Rename some file.
363-
File fooFile = new File(repositoryRoot, "Makefile");
364+
final String fooFileName = "Makefile";
365+
final String barFileName = "Makefile.renamed";
366+
File fooFile = new File(repositoryRoot, fooFileName);
364367
assertTrue(fooFile.exists());
365-
File barFile = new File(repositoryRoot, "Makefile.renamed");
368+
File barFile = new File(repositoryRoot, barFileName);
366369
assertTrue(fooFile.renameTo(barFile));
367-
git.add().addFilepattern("Makefile.renamed").call();
368-
git.rm().addFilepattern("Makefile").call();
370+
git.add().addFilepattern(barFileName).call();
371+
git.rm().addFilepattern(fooFileName).call();
369372
git.commit().setMessage("rename").setAuthor("foo", "[email protected]").setAll(true).call();
373+
assertTrue(barFile.exists());
374+
assertFalse(fooFile.exists());
370375

371376
addMergeCommit(git, repositoryRoot);
372377
}

0 commit comments

Comments
 (0)