Skip to content

Commit

Permalink
cdancy#226 Add test for case with no testReport
Browse files Browse the repository at this point in the history
  • Loading branch information
tyge68 committed May 3, 2022
1 parent d98c56b commit 6879fb0
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ public void testPipelineNodeNotExist() throws Exception {
}
}

public void testJobTestReport() throws Exception {
public void testJobTestReportExists() throws Exception {
MockWebServer server = mockWebServer();

server.enqueue(new MockResponse().setHeader("Content-Type", "application/json").setBody("{ \"empty\": false }").setResponseCode(200));
Expand All @@ -976,6 +976,21 @@ public void testJobTestReport() throws Exception {
}
}

public void testJobTestReportNotExists() throws Exception {
MockWebServer server = mockWebServer();

server.enqueue(new MockResponse().setResponseCode(404));
JenkinsApi jenkinsApi = api(server.getUrl("/"));
JobsApi api = jenkinsApi.jobsApi();
try {
JsonObject testReport = api.testReport(null,"DevTest",16);
assertNull(testReport);
} finally {
jenkinsApi.close();
server.shutdown();
}
}

public void testPipelineNodeLog() throws Exception {
MockWebServer server = mockWebServer();
String body = payloadFromResource("/pipelineNodeLog.json");
Expand Down

0 comments on commit 6879fb0

Please sign in to comment.