diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml
index bbd5d0b..21fac2f 100644
--- a/.gitea/workflows/ci.yml
+++ b/.gitea/workflows/ci.yml
@@ -14,6 +14,15 @@ jobs:
with:
fetch-depth: 0
+ - name: Set up JDK 17
+ uses: actions/setup-java@v2
+ with:
+ java-version: '17'
+ distribution: 'eclipse-temurin'
+
+ - name: Run Tests
+ run: mvn --batch-mode test
+
- name: Push to dokku
uses: dokku/github-action@master
with:
diff --git a/pom.xml b/pom.xml
index 477ae73..e38df86 100644
--- a/pom.xml
+++ b/pom.xml
@@ -66,11 +66,6 @@
org.springframework.boot
spring-boot-starter-web
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
org.springframework.boot
spring-boot-starter-thymeleaf
@@ -88,6 +83,31 @@
5.3.1
compile
+
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ 5.10.2
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ 5.10.2
+ test
+
+
+ org.springframework
+ spring-test
+ 6.1.5
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
\ No newline at end of file
diff --git a/src/main/java/cc/fascinated/model/player/Player.java b/src/main/java/cc/fascinated/model/player/Player.java
index c150180..b5b3570 100644
--- a/src/main/java/cc/fascinated/model/player/Player.java
+++ b/src/main/java/cc/fascinated/model/player/Player.java
@@ -3,6 +3,7 @@ package cc.fascinated.model.player;
import cc.fascinated.model.mojang.MojangProfile;
import cc.fascinated.util.Tuple;
import cc.fascinated.util.UUIDUtils;
+import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import java.util.UUID;
@@ -16,8 +17,9 @@ public class Player {
private final UUID uuid;
/**
- * The name of the player
+ * The username of the player
*/
+ @JsonProperty("username")
private final String name;
/**
diff --git a/src/main/java/cc/fascinated/model/player/Skin.java b/src/main/java/cc/fascinated/model/player/Skin.java
index 18e54f9..91ce88c 100644
--- a/src/main/java/cc/fascinated/model/player/Skin.java
+++ b/src/main/java/cc/fascinated/model/player/Skin.java
@@ -104,6 +104,15 @@ public class Skin {
*/
private final int defaultSize;
+ /**
+ * Gets the name of the part.
+ *
+ * @return the name of the part
+ */
+ public String getName() {
+ return this.name().toLowerCase();
+ }
+
/**
* Gets the skin part from its name.
*
diff --git a/src/test/java/cc/fascinated/PlayerControllerTests.java b/src/test/java/cc/fascinated/PlayerControllerTests.java
new file mode 100644
index 0000000..766720c
--- /dev/null
+++ b/src/test/java/cc/fascinated/PlayerControllerTests.java
@@ -0,0 +1,40 @@
+package cc.fascinated;
+
+import cc.fascinated.model.player.Skin;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.http.MediaType;
+import org.springframework.test.web.servlet.MockMvc;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+@AutoConfigureMockMvc
+@SpringBootTest
+class PlayerControllerTests {
+
+ @Autowired
+ private MockMvc mockMvc;
+
+ @Test
+ public void testPlayerLookup() throws Exception {
+ mockMvc.perform(get("/player/eeab5f8a-18dd-4d58-af78-2b3c4543da48")
+ .accept(MediaType.APPLICATION_JSON)
+ .contentType(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk())
+ .andExpect(jsonPath("$.username").value("ImFascinated"));
+ }
+
+ @Test
+ public void testPlayerPartsLookup() throws Exception {
+ for (Skin.Parts part : Skin.Parts.values()) {
+ mockMvc.perform(get("/player/" + part.getName() + "/eeab5f8a-18dd-4d58-af78-2b3c4543da48")
+ .accept(MediaType.IMAGE_PNG)
+ .contentType(MediaType.IMAGE_PNG))
+ .andExpect(status().isOk());
+ }
+ }
+}
diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
index 9f1cbaf..5b19640 100644
--- a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
+++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
@@ -1,16 +1,2 @@
-cc\fascinated\player\impl\Skin.class
cc\fascinated\Main.class
-cc\fascinated\player\impl\SkinPart.class
-cc\fascinated\mojang\types\MojangSessionServerProfileProperties.class
-cc\fascinated\mojang\MojangAPIService$1.class
-cc\fascinated\mojang\types\MojangApiProfile.class
-cc\fascinated\player\impl\Player.class
-cc\fascinated\mojang\MojangAPIService$2.class
-cc\fascinated\player\impl\SkinType.class
-cc\fascinated\player\impl\Cape.class
-cc\fascinated\player\PlayerManagerService.class
cc\fascinated\util\UUIDUtils.class
-cc\fascinated\mojang\types\MojangSessionServerProfile.class
-cc\fascinated\mojang\MojangAPIService.class
-cc\fascinated\Consts.class
-cc\fascinated\api\controller\PlayerController.class
diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
index 18ecb82..bc0a2fd 100644
--- a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
+++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
@@ -1,14 +1,20 @@
-C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\mojang\types\MojangSessionServerProfileProperties.java
-C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\player\impl\Player.java
-C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\player\impl\SkinType.java
-C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\player\impl\Cape.java
-C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\player\impl\Skin.java
-C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\mojang\types\MojangSessionServerProfile.java
+C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\model\mojang\MojangUsernameToUuid.java
+C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\service\PlayerService.java
+C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\model\mojang\MojangProfile.java
+C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\model\response\Response.java
+C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\controller\HomeController.java
+C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\model\player\Player.java
+C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\log\TransactionLogger.java
+C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\util\IPUtils.java
+C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\config\Config.java
+C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\controller\PlayerController.java
+C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\exception\ExceptionControllerAdvice.java
C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\Main.java
-C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\player\PlayerManagerService.java
-C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\mojang\types\MojangApiProfile.java
+C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\model\player\Cape.java
+C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\service\MojangAPIService.java
C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\util\UUIDUtils.java
-C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\Consts.java
-C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\player\impl\SkinPart.java
-C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\mojang\MojangAPIService.java
-C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\api\controller\PlayerController.java
+C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\model\player\Skin.java
+C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\util\Tuple.java
+C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\util\WebRequest.java
+C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\model\response\impl\PlayerNotFoundResponse.java
+C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\main\java\cc\fascinated\util\PlayerUtils.java
diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
index e69de29..b6f1615 100644
--- a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
+++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
@@ -0,0 +1 @@
+C:\Users\Liam\Desktop\Projects\Minecraft-Helper\src\test\java\cc\fascinated\PlayerControllerTests.java