Skip to content

Commit

Permalink
Merge pull request jenkinsci#79 from MarkEWaite/master-add-SRC_DIR-lo…
Browse files Browse the repository at this point in the history
…cation-test

Add test that working directory is as expected for test success
  • Loading branch information
ndeloof committed Jan 23, 2014
2 parents 88a0421 + 930a8b2 commit 4be87e2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/test/java/org/jenkinsci/plugins/gitclient/GitAPITestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ public void test_clone_reference() throws IOException, InterruptedException

public void test_clone_reference_working_repo() throws IOException, InterruptedException
{
assertTrue("SRC_DIR " + SRC_DIR + " has no .git subdir", (new File(SRC_DIR + File.separator + ".git").isDirectory()));
w.git.clone_().url(localMirror()).repositoryName("origin").reference(SRC_DIR).execute();
if (w.git instanceof CliGitAPIImpl) {
w.git.setRemoteUrl("origin", localMirror());
Expand Down Expand Up @@ -661,6 +662,18 @@ public void test_revparse_sha1_HEAD_or_tag() throws Exception {
assertEquals(sha1, w.git.revParse("test").name());
}

public void test_revparse_throws_expected_exception() throws Exception {
w.init();
w.commit("init");
try {
w.git.revParse("unknown-rev-to-parse");
fail("Did not throw exception");
} catch (GitException ge) {
final String msg = ge.getMessage();
assertTrue("Wrong exception: " + msg, msg.contains("unknown-rev-to-parse"));
}
}

public void test_hasGitRepo_without_git_directory() throws Exception
{
assertFalse("Empty directory has a Git repo", w.git.hasGitRepo());
Expand Down

0 comments on commit 4be87e2

Please sign in to comment.