diff --git a/src/main/java/cc/fascinated/controller/PlayerController.java b/src/main/java/cc/fascinated/controller/PlayerController.java index a1dd9c0..2dd5dbf 100644 --- a/src/main/java/cc/fascinated/controller/PlayerController.java +++ b/src/main/java/cc/fascinated/controller/PlayerController.java @@ -26,7 +26,8 @@ public class PlayerController { this.playerManagerService = playerManagerService; } - @GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody + @ResponseBody + @GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity getPlayer(@PathVariable String id) { Player player = playerManagerService.getPlayer(id); if (player == null) { // No player with that id was found @@ -36,7 +37,6 @@ public class PlayerController { return ResponseEntity.ok() .cacheControl(cacheControl) .body(player); - } @GetMapping(value = "/{part}/{id}") diff --git a/src/test/java/cc/fascinated/PlayerControllerTests.java b/src/test/java/cc/fascinated/PlayerControllerTests.java index 5b5053b..b57f3d2 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 ensurePlayerLookupSuccess() throws Exception { + public void ensurePlayerLookupUuidSuccess() throws Exception { mockMvc.perform(get("/player/eeab5f8a-18dd-4d58-af78-2b3c4543da48") .accept(MediaType.APPLICATION_JSON) .contentType(MediaType.APPLICATION_JSON)) @@ -28,6 +28,15 @@ class PlayerControllerTests { .andExpect(jsonPath("$.username").value("ImFascinated")); } + @Test + public void ensurePlayerLookupUsernameSuccess() throws Exception { + mockMvc.perform(get("/player/ImFascinated") + .accept(MediaType.APPLICATION_JSON) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.username").value("ImFascinated")); + } + @Test public void ensurePlayerLookupFailure() throws Exception { mockMvc.perform(get("/player/invalidnamehahahahahayesslmaooo") @@ -37,7 +46,7 @@ class PlayerControllerTests { } @Test - public void ensurePlayerPartsLookupSuccess() throws Exception { + public void ensurePlayerSkinPartsLookupSuccess() throws Exception { for (Skin.Parts part : Skin.Parts.values()) { mockMvc.perform(get("/player/" + part.getName() + "/eeab5f8a-18dd-4d58-af78-2b3c4543da48") .accept(MediaType.IMAGE_PNG) @@ -46,9 +55,8 @@ class PlayerControllerTests { } } - @Test - public void ensurePlayerPartsLookupFailure() throws Exception { + public void ensurePlayerSkinPartsLookupFailure() throws Exception { mockMvc.perform(get("/player/invalidpart/eeab5f8a-18dd-4d58-af78-2b3c4543da48")) .andExpect(status().isNotFound()); } diff --git a/target/classes/templates/index.html b/target/classes/templates/index.html index 0779cab..5adc0a7 100644 --- a/target/classes/templates/index.html +++ b/target/classes/templates/index.html @@ -15,11 +15,12 @@ -

Hello!!!

+

Hello!

Wrapper for the Minecraft APIs to make them easier to use.

+ Source Code
-

Player Data: ???

+

Player Data: ???

\ No newline at end of file