Skip to content

Commit

Permalink
style: 컨벤션 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Choi-JJunho committed Nov 22, 2023
1 parent 41d29a6 commit 42e18e2
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package com.official.pium.service;

import com.official.pium.domain.*;
import com.official.pium.domain.DictionaryPlant;
import com.official.pium.domain.History;
import com.official.pium.domain.HistoryType;
import com.official.pium.domain.Member;
import com.official.pium.domain.PetPlant;
import com.official.pium.event.history.HistoryEvent;
import com.official.pium.event.history.HistoryEvents;
import com.official.pium.event.history.LastWaterDateEvent;
Expand All @@ -9,7 +13,11 @@
import com.official.pium.repository.DictionaryPlantRepository;
import com.official.pium.repository.HistoryRepository;
import com.official.pium.repository.PetPlantRepository;
import com.official.pium.service.dto.*;
import com.official.pium.service.dto.DataResponse;
import com.official.pium.service.dto.PetPlantCreateRequest;
import com.official.pium.service.dto.PetPlantResponse;
import com.official.pium.service.dto.PetPlantUpdateRequest;
import com.official.pium.service.dto.SinglePetPlantResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationEventPublisher;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.List;
@Getter
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class DictionaryPlantResponse {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
package com.official.pium.util;

import com.official.pium.service.PhotoManager;
import java.io.File;
import java.io.IOException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

@Component
public class PhotoLocalManager implements PhotoManager {

private static final String SLASH = "/";
private static final int NOT_FOUND_INDEX = -1;

@Value("${local.image.web}")
private String webPath;
Expand Down Expand Up @@ -68,7 +70,8 @@ public void delete(String originalImageUrl, String workingDirectory) {

private String getFileLocalPath(String fullPath) {
int urlIndex = fullPath.lastIndexOf(webPath);
if (urlIndex == -1) {

if (urlIndex == NOT_FOUND_INDEX) {
throw new IllegalArgumentException("잘못된 파일 경로입니다.");
}
int urlNextIndex = urlIndex + webPath.length();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
public class ImageCleanerExtension implements AfterEachCallback {

@Override
public void afterEach(ExtensionContext context) throws Exception {
public void afterEach(ExtensionContext context) {
ImageCleaner.cleanUp();
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package com.official.pium.fixture;

import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import org.springframework.http.MediaType;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.multipart.MultipartFile;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;

public class FileFixture {

public static final String IMAGE_PATH = "image";

private static final byte[] IMAGE = generateMockImage();

public static byte[] generateMockImage() {
Expand All @@ -28,10 +27,10 @@ public static byte[] generateMockImage() {

public static MultipartFile generateMultiPartFile() {
return new MockMultipartFile(
"image",
"pium.jpg",
MediaType.IMAGE_JPEG_VALUE,
IMAGE
"image",
"pium.jpg",
MediaType.IMAGE_JPEG_VALUE,
IMAGE
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,17 @@
import com.official.pium.fixture.FileFixture;
import com.official.pium.repository.HistoryRepository;
import com.official.pium.repository.PetPlantRepository;
import com.official.pium.service.dto.*;
import org.junit.jupiter.api.*;
import com.official.pium.service.dto.DataResponse;
import com.official.pium.service.dto.PetPlantCreateRequest;
import com.official.pium.service.dto.PetPlantResponse;
import com.official.pium.service.dto.PetPlantUpdateRequest;
import com.official.pium.service.dto.ReminderCreateRequest;
import com.official.pium.service.dto.SinglePetPlantResponse;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayNameGeneration;
import org.junit.jupiter.api.DisplayNameGenerator;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
Expand All @@ -29,7 +38,9 @@
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.*;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;

@ExtendWith(ImageCleanerExtension.class)
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.official.pium.util;

import static org.assertj.core.api.Assertions.assertThat;

import com.official.pium.IntegrationTest;
import com.official.pium.config.ImageCleanerExtension;
import com.official.pium.fixture.FileFixture;
Expand All @@ -10,11 +8,11 @@
import org.junit.jupiter.api.DisplayNameGenerator;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.web.multipart.MultipartFile;

import static org.assertj.core.api.Assertions.assertThat;

@ExtendWith(ImageCleanerExtension.class)
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class)
@SuppressWarnings("NonAsciiCharacters")
Expand Down

0 comments on commit 42e18e2

Please sign in to comment.