more tests

This commit is contained in:
Lee 2024-04-08 07:22:03 +01:00
parent ed91afe3ee
commit 15c0002ddb

@ -20,7 +20,7 @@ class PlayerControllerTests {
private MockMvc mockMvc; private MockMvc mockMvc;
@Test @Test
public void testPlayerLookup() throws Exception { public void ensurePlayerLookupSuccess() throws Exception {
mockMvc.perform(get("/player/eeab5f8a-18dd-4d58-af78-2b3c4543da48") mockMvc.perform(get("/player/eeab5f8a-18dd-4d58-af78-2b3c4543da48")
.accept(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)
.contentType(MediaType.APPLICATION_JSON)) .contentType(MediaType.APPLICATION_JSON))
@ -29,7 +29,15 @@ class PlayerControllerTests {
} }
@Test @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()) { for (Skin.Parts part : Skin.Parts.values()) {
mockMvc.perform(get("/player/" + part.getName() + "/eeab5f8a-18dd-4d58-af78-2b3c4543da48") mockMvc.perform(get("/player/" + part.getName() + "/eeab5f8a-18dd-4d58-af78-2b3c4543da48")
.accept(MediaType.IMAGE_PNG) .accept(MediaType.IMAGE_PNG)
@ -37,4 +45,13 @@ class PlayerControllerTests {
.andExpect(status().isOk()); .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());
}
} }