From 69393472c14ddfe0a6f00f00f7c2b693b0b0264f Mon Sep 17 00:00:00 2001 From: Rainnny7 Date: Tue, 9 Apr 2024 00:22:02 -0400 Subject: [PATCH] Add Bedrock server tests --- .../controller/ServerControllerTests.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/test/java/me/braydon/mc/test/controller/ServerControllerTests.java b/src/test/java/me/braydon/mc/test/controller/ServerControllerTests.java index b6655f5..4674325 100644 --- a/src/test/java/me/braydon/mc/test/controller/ServerControllerTests.java +++ b/src/test/java/me/braydon/mc/test/controller/ServerControllerTests.java @@ -72,6 +72,23 @@ public final class ServerControllerTests { ).andReturn(); } + /** + * Run a test to ensure retrieving + * a Bedrock server's status is successful. + * + * @throws Exception if the test fails + */ + @Test + void ensureBedrockServerLookupSuccess() throws Exception { + mockMvc.perform(get("/server/bedrock/gateway.wildnetwork.net") + .accept(MediaType.APPLICATION_JSON) // Accept JSON + .contentType(MediaType.APPLICATION_JSON) // Content type is JSON + ).andExpect(status().isOk()) // Expect 200 (OK) + .andExpect(jsonPath("$.value.hostname") // Expect the server's resolved hostname + .value("gateway.wildnetwork.net") + ).andReturn(); + } + /** * Run a test to ensure that requesting * information about a server on an invalid @@ -127,7 +144,7 @@ public final class ServerControllerTests { */ @Test void ensureServerFaviconSuccess() throws Exception { - mockMvc.perform(get("/server/icon/java/hypixel.net") + mockMvc.perform(get("/server/icon/hypixel.net") .contentType(MediaType.IMAGE_PNG) // Content type is PNG ).andExpect(status().isOk()) // Expect 200 (OK) .andReturn();