Skip to content

Commit

Permalink
refactor: 이미지 상한이 없는 컨텐츠의 maxImageCount 값을 0으로 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
amaran-th committed Sep 25, 2023
1 parent ab626da commit fc31ef3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@

public enum ImageType {
FEED(5),
EVENT(200);
EVENT(0);

private static final int NO_LIMIT_COUNT = 0;
private final int maxImageCount;

ImageType(final int maxImageCount) {
this.maxImageCount = maxImageCount;
}

public boolean isOverMaxImageCount(final int imageCount) {
if (maxImageCount == NO_LIMIT_COUNT) {
return false;
}
return imageCount > maxImageCount;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class ImageTypeTest {

@ParameterizedTest
@CsvSource(value = {"FEED:3:false", "FEED:6:true"}, delimiter = ':')
@CsvSource(value = {"FEED:3:false", "FEED:6:true", "EVENT:999:false"}, delimiter = ':')
@DisplayName("isOverMaxImageCount(): 입력받은 값이 이미지 유형의 최대 이미지 수보다 큰지 여부를 반환한다.")
void isOverMaxImageCount(final ImageType type, final int imageCount, final boolean expected) {
//given, when
Expand Down

0 comments on commit fc31ef3

Please sign in to comment.