Skip to content

Commit

Permalink
Update InventoryEndpointIT.java (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
gkwan-ibm authored Jun 13, 2024
1 parent 4bdc733 commit 4228d3f
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,22 +119,22 @@ public void testValue() {

@Test
@Order(3)
// tag::testUnknown[]
public void testUnknown() {
// tag::testUnknownHost[]
public void testUnknownHost() {
Response badResponse = client
.target(baseUrl + INVENTORY_SYSTEMS + "/" + "badhostname")
.request(MediaType.APPLICATION_JSON).get();
.target(baseUrl + INVENTORY_SYSTEMS + "/" + "badhostname")
.request(MediaType.APPLICATION_JSON).get();

assertEquals(404, badResponse.getStatus(),
"BadResponse expected status: 404. Response code not as expected.");
"BadResponse expected status: 404. Response code not as expected.");

String stringObj = badResponse.readEntity(String.class);
assertTrue(stringObj.contains("hostname does not exist."),
"badhostname is not a valid host but it didn't raise an error");
"badhostname is not a valid host but it didn't raise an error");

badResponse.close();
}
// end::testUnknown[]
// end::testUnknownHost[]
// end::tests[]

private Response getResponse(String url) {
Expand Down

0 comments on commit 4228d3f

Please sign in to comment.