From db2b3793dae012417fe698f9e543e8de323f61db Mon Sep 17 00:00:00 2001 From: kmebin Date: Tue, 28 Nov 2023 16:18:09 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20URL?= =?UTF-8?q?=EC=97=90=20=EC=9E=91=EC=9D=80=20=EB=94=B0=EC=98=B4=ED=91=9C=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/moabam/api/domain/room/Room.java | 12 +++++------ .../com/moabam/api/domain/room/RoomTest.java | 20 +++++++++++++++++++ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/moabam/api/domain/room/Room.java b/src/main/java/com/moabam/api/domain/room/Room.java index 8f6024a6..00a7ac42 100644 --- a/src/main/java/com/moabam/api/domain/room/Room.java +++ b/src/main/java/com/moabam/api/domain/room/Room.java @@ -32,11 +32,11 @@ public class Room extends BaseTimeEntity { private static final int LEVEL_10 = 10; private static final int LEVEL_20 = 20; private static final int LEVEL_30 = 30; - private static final String ROOM_LEVEL_0_IMAGE = "'https://image.moabam.com/moabam/default/room-level-00.png'"; - private static final String ROOM_LEVEL_5_IMAGE = "'https://image.moabam.com/moabam/default/room-level-05.png'"; - private static final String ROOM_LEVEL_10_IMAGE = "'https://image.moabam.com/moabam/default/room-level-10.png'"; - private static final String ROOM_LEVEL_20_IMAGE = "'https://image.moabam.com/moabam/default/room-level-20.png'"; - private static final String ROOM_LEVEL_30_IMAGE = "'https://image.moabam.com/moabam/default/room-level-30.png'"; + private static final String ROOM_LEVEL_0_IMAGE = "https://image.moabam.com/moabam/default/room-level-00.png"; + private static final String ROOM_LEVEL_5_IMAGE = "https://image.moabam.com/moabam/default/room-level-05.png"; + private static final String ROOM_LEVEL_10_IMAGE = "https://image.moabam.com/moabam/default/room-level-10.png"; + private static final String ROOM_LEVEL_20_IMAGE = "https://image.moabam.com/moabam/default/room-level-20.png"; + private static final String ROOM_LEVEL_30_IMAGE = "https://image.moabam.com/moabam/default/room-level-30.png"; private static final int MORNING_START_TIME = 4; private static final int MORNING_END_TIME = 10; private static final int NIGHT_START_TIME = 20; @@ -78,7 +78,7 @@ public class Room extends BaseTimeEntity { @Column(name = "announcement", length = 100) private String announcement; - @ColumnDefault(ROOM_LEVEL_0_IMAGE) + @ColumnDefault("'" + ROOM_LEVEL_0_IMAGE + "'") @Column(name = "room_image", length = 500) private String roomImage; diff --git a/src/test/java/com/moabam/api/domain/room/RoomTest.java b/src/test/java/com/moabam/api/domain/room/RoomTest.java index b69db4b0..8edb92d3 100644 --- a/src/test/java/com/moabam/api/domain/room/RoomTest.java +++ b/src/test/java/com/moabam/api/domain/room/RoomTest.java @@ -9,6 +9,7 @@ import com.moabam.global.error.exception.BadRequestException; import com.moabam.global.error.model.ErrorMessage; +import com.moabam.support.fixture.RoomFixture; class RoomTest { @@ -88,4 +89,23 @@ void night_time_validate_exception(int certifyTime) { .isInstanceOf(BadRequestException.class) .hasMessage(ErrorMessage.INVALID_REQUEST_FIELD.getMessage()); } + + @DisplayName("레벨에 따른 이미지 업데이트") + @ParameterizedTest + @CsvSource({ + "5, https://image.moabam.com/moabam/default/room-level-05.png", + "10, https://image.moabam.com/moabam/default/room-level-10.png", + "20, https://image.moabam.com/moabam/default/room-level-20.png", + "30, https://image.moabam.com/moabam/default/room-level-30.png", + }) + void update_room_image_success(int level, String image) { + // given + Room room = RoomFixture.room(); + + // when + room.upgradeRoomImage(level); + + // then + assertThat(room.getRoomImage()).isEqualTo(image); + } }