Skip to content

Commit 0ff66b1

Browse files
author
Vladimir Kotal
committed
add more coverage and negative test
1 parent 1aebb54 commit 0ff66b1

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

test/org/opensolaris/opengrok/history/SCCSRepositoryTest.java

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,37 @@ public void tearDown() {
6262
/**
6363
* Test of isRepositoryFor method, of class SCCSRepository.
6464
*/
65-
private void testIsRepositoryFor(final String fileName) throws IOException {
65+
private void testIsRepositoryFor(final String fileName, boolean shouldPass) throws IOException {
6666
File tdir = Files.createTempDirectory("SCCSrepotest" + fileName).toFile();
6767
File test = new File(tdir, fileName);
6868
test.mkdirs();
6969
tdir.deleteOnExit();
7070
test.deleteOnExit();
71-
SCCSRepository instance = new SCCSRepository();
72-
assertTrue(instance.isRepositoryFor(tdir));
71+
SCCSRepository instance = new SCCSRepository();
72+
if (shouldPass) {
73+
assertTrue(instance.isRepositoryFor(tdir));
74+
} else {
75+
assertFalse(instance.isRepositoryFor(tdir));
76+
}
7377
}
7478

7579
@Test
7680
public void testIsRepositoryForCodemgr1() throws IOException {
77-
testIsRepositoryFor("Codemgr_wsdata");
81+
testIsRepositoryFor("Codemgr_wsdata", true);
7882
}
7983

8084
@Test
8185
public void testIsRepositoryForCodemgr2() throws IOException {
82-
testIsRepositoryFor("codemgr_wsdata");
86+
testIsRepositoryFor("codemgr_wsdata", true);
87+
}
88+
89+
@Test
90+
public void testIsRepositoryForCodemgr3() throws IOException {
91+
testIsRepositoryFor("SCCS", true);
92+
}
93+
94+
@Test
95+
public void testIsRepositoryForCodemgrNot() throws IOException {
96+
testIsRepositoryFor("NOT", false);
8397
}
8498
}

0 commit comments

Comments
 (0)