fix skin part tests

This commit is contained in:
Lee 2024-04-12 18:48:13 +01:00
parent 2ea58d8080
commit a1ad295e0c
3 changed files with 9 additions and 8 deletions

View File

@ -9,7 +9,6 @@ import java.awt.*;
import java.awt.geom.AffineTransform; import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException;
@Log4j2 @Log4j2
public class ImageUtils { public class ImageUtils {

View File

@ -2,7 +2,6 @@ package cc.fascinated.controller;
import cc.fascinated.model.cache.CachedPlayer; import cc.fascinated.model.cache.CachedPlayer;
import cc.fascinated.model.cache.CachedPlayerName; import cc.fascinated.model.cache.CachedPlayerName;
import cc.fascinated.model.skin.Skin;
import cc.fascinated.service.PlayerService; import cc.fascinated.service.PlayerService;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;

View File

@ -1,7 +1,7 @@
package cc.fascinated.tests; package cc.fascinated.tests;
import cc.fascinated.config.TestRedisConfig; import cc.fascinated.config.TestRedisConfig;
import cc.fascinated.model.skin.Skin; import cc.fascinated.model.skin.ISkinPart;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
@ -70,12 +70,15 @@ class PlayerControllerTests {
@Test @Test
public void ensurePlayerSkinPartsLookupSuccess() throws Exception { public void ensurePlayerSkinPartsLookupSuccess() throws Exception {
for (Skin.Parts part : Skin.Parts.values()) { for (Enum<?>[] type : ISkinPart.TYPES) {
mockMvc.perform(get("/player/" + part.getName() + "/" + testPlayerUuid) for (Enum<?> part : type) {
.accept(MediaType.IMAGE_PNG) mockMvc.perform(get("/player/" + part.name().toLowerCase() + "/" + testPlayer)
.contentType(MediaType.IMAGE_PNG)) .accept(MediaType.APPLICATION_JSON)
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()); .andExpect(status().isOk());
} }
}
} }
@Test @Test