Skip to content

Commit a4eaffc

Browse files
committed
add test for non-existent project
1 parent 3ec9c27 commit a4eaffc

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test/org/opensolaris/opengrok/configuration/messages/ProjectMessageTest.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,21 +394,28 @@ public void testList() throws Exception {
394394

395395
@Test
396396
public void testGetRepos() throws Exception {
397+
// Try to get repos for non-existent project first.
398+
Message m = new ProjectMessage();
399+
m.setText("get-repos");
400+
m.addTag("totally-nonexistent-project");
401+
String out = new String(m.apply(env));
402+
Assert.assertEquals("", out);
403+
397404
// Create subrepository.
398405
File mercurialRoot = new File(repository.getSourceRoot() + File.separator + "mercurial");
399406
MercurialRepositoryTest.runHgCommand(mercurialRoot,
400407
"clone", mercurialRoot.getAbsolutePath(),
401408
mercurialRoot.getAbsolutePath() + File.separator + "closed");
402409

403410
// Add a project
404-
Message m = new ProjectMessage();
411+
m = new ProjectMessage();
405412
m.setText("add");
406413
m.addTag("mercurial");
407414
m.apply(env);
408415

409416
// Get repositories of the project.
410417
m.setText("get-repos");
411-
String out = new String(m.apply(env));
418+
out = new String(m.apply(env));
412419

413420
// Perform cleanup of the subrepository in order not to interefere
414421
// with other tests.

0 commit comments

Comments
 (0)