From 15c0002ddbd16ddb72cc0ce09b35b65c281b6a97 Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 8 Apr 2024 07:22:03 +0100 Subject: [PATCH] more tests --- .../cc/fascinated/PlayerControllerTests.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/test/java/cc/fascinated/PlayerControllerTests.java b/src/test/java/cc/fascinated/PlayerControllerTests.java index 766720c..cd685d4 100644 --- a/src/test/java/cc/fascinated/PlayerControllerTests.java +++ b/src/test/java/cc/fascinated/PlayerControllerTests.java @@ -20,7 +20,7 @@ class PlayerControllerTests { private MockMvc mockMvc; @Test - public void testPlayerLookup() throws Exception { + public void ensurePlayerLookupSuccess() throws Exception { mockMvc.perform(get("/player/eeab5f8a-18dd-4d58-af78-2b3c4543da48") .accept(MediaType.APPLICATION_JSON) .contentType(MediaType.APPLICATION_JSON)) @@ -29,7 +29,15 @@ class PlayerControllerTests { } @Test - public void testPlayerPartsLookup() throws Exception { + public void ensurePlayerLookupFailure() throws Exception { + mockMvc.perform(get("/player/invalidnamehahahahahayesslmaooo") + .accept(MediaType.APPLICATION_JSON) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isNotFound()); + } + + @Test + public void ensurePlayerPartsLookupSuccess() throws Exception { for (Skin.Parts part : Skin.Parts.values()) { mockMvc.perform(get("/player/" + part.getName() + "/eeab5f8a-18dd-4d58-af78-2b3c4543da48") .accept(MediaType.IMAGE_PNG) @@ -37,4 +45,13 @@ class PlayerControllerTests { .andExpect(status().isOk()); } } + + + @Test + public void ensurePlayerPartsLookupFailure() throws Exception { + mockMvc.perform(get("/player/invalidpart/eeab5f8a-18dd-4d58-af78-2b3c4543da48") + .accept(MediaType.IMAGE_PNG) + .contentType(MediaType.IMAGE_PNG)) + .andExpect(status().isNotFound()); + } }