Skip to content

Commit

Permalink
♻️ Rename Opacity to VisitOpacity
Browse files Browse the repository at this point in the history
  • Loading branch information
youngreal committed Jul 31, 2024
1 parent fa06d01 commit 971c144
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions src/main/java/com/dnd/dndtravel/map/domain/Region.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ public class Region {
private String name; // 지역 이름

@Enumerated(EnumType.STRING)
private Opacity opacity; // 방문 횟수(색의 opacity)
private VisitOpacity visitOpacity; // 방문 횟수(색의 opacity)

public static Region of(String name, Opacity opacity) {
return new Region(name, opacity);
public static Region of(String name, VisitOpacity visitOpacity) {
return new Region(name, visitOpacity);
}

public boolean isVisited() {
return opacity.isNotZero();
return visitOpacity.isNotZero();
}

private Region(String name, Opacity opacity) {
private Region(String name, VisitOpacity visitOpacity) {
this.name = name;
this.opacity = opacity;
this.visitOpacity = visitOpacity;
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.dnd.dndtravel.map.domain;

public enum Opacity {
public enum VisitOpacity {
ZERO(0), ONE(1), TWO(2), THREE(3);

private final int value;

Opacity(int value) {
VisitOpacity(int value) {
this.value = value;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ public record RegionDto(
) {

public static RegionDto from(Region region) {
return new RegionDto(region.getName(), region.getOpacity().toInt());
return new RegionDto(region.getName(), region.getVisitOpacity().toInt());
}
}
20 changes: 10 additions & 10 deletions src/test/java/com/dnd/dndtravel/map/service/MapServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;

import com.dnd.dndtravel.map.domain.Opacity;
import com.dnd.dndtravel.map.domain.VisitOpacity;
import com.dnd.dndtravel.map.domain.Region;
import com.dnd.dndtravel.map.repository.MapRepository;
import com.dnd.dndtravel.map.service.dto.response.RegionResponse;
Expand Down Expand Up @@ -52,23 +52,23 @@ private static Stream<Arguments> provideRegionsForTesting() {

// 모든 지역이 방문되지 않은 경우
Arguments.of(List.of(
Region.of("서울특별시", Opacity.ZERO),
Region.of("부산", Opacity.ZERO),
Region.of("충청도", Opacity.ZERO)
Region.of("서울특별시", VisitOpacity.ZERO),
Region.of("부산", VisitOpacity.ZERO),
Region.of("충청도", VisitOpacity.ZERO)
), 0, 3),

// 모든 지역이 방문된 경우
Arguments.of(List.of(
Region.of("서울특별시", Opacity.ONE),
Region.of("부산", Opacity.ONE),
Region.of("충청도", Opacity.ONE)
Region.of("서울특별시", VisitOpacity.ONE),
Region.of("부산", VisitOpacity.ONE),
Region.of("충청도", VisitOpacity.ONE)
), 3, 3),

// 일부 지역만 방문된 경우
Arguments.of(List.of(
Region.of("서울특별시", Opacity.ONE),
Region.of("부산", Opacity.ZERO),
Region.of("충청도", Opacity.ONE)
Region.of("서울특별시", VisitOpacity.ONE),
Region.of("부산", VisitOpacity.ZERO),
Region.of("충청도", VisitOpacity.ONE)
), 2, 3)
);
}
Expand Down

0 comments on commit 971c144

Please sign in to comment.