Skip to content

Commit 1cffea8

Browse files
committed
add test
1 parent fd85981 commit 1cffea8

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

src/test/java/org/kohsuke/github/RepositoryTest.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,32 @@ public void getPermission() throws Exception {
6767
}
6868
}
6969
}
70+
71+
72+
73+
@Test
74+
public void LatestRepositoryExist() {
75+
try {
76+
// add the repository that have latest release
77+
GHRelease release = gitHub.getRepository("kamontat/CheckIDNumber").getLatestRelease();
78+
assertEquals("v3.0", release.getTagName());
79+
} catch (IOException e) {
80+
e.printStackTrace();
81+
fail();
82+
}
83+
}
84+
85+
@Test
86+
public void LatestRepositoryNotExist() {
87+
try {
88+
// add the repository that `NOT` have latest release
89+
GHRelease release = gitHub.getRepository("kamontat/Java8Example").getLatestRelease();
90+
assertNull(release);
91+
} catch (IOException e) {
92+
e.printStackTrace();
93+
fail();
94+
}
95+
}
7096

7197
private GHRepository getRepository() throws IOException {
7298
return gitHub.getOrganization("github-api-test-org").getRepository("jenkins");

0 commit comments

Comments
 (0)