-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from BbeumbungE/feat/BACK-293
fix: 신규 레코드 생성시 예외처리 로직 수정
- Loading branch information
Showing
18 changed files
with
203 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/java/com/siliconvalley/domain/google/controller/DetectingTestController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.siliconvalley.domain.google.controller; | ||
|
||
import com.siliconvalley.domain.google.service.VisionDetectingService; | ||
import com.siliconvalley.global.common.code.CommonCode; | ||
import com.siliconvalley.global.common.dto.Response; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequestMapping("/api/test/google") | ||
@RequiredArgsConstructor | ||
public class DetectingTestController { | ||
|
||
private final VisionDetectingService visionDetectingService; | ||
|
||
@GetMapping("{canvasId}") | ||
public ResponseEntity<Response> test( | ||
@PathVariable Long canvasId | ||
){ | ||
return ResponseEntity.ok(visionDetectingService.testLabelDetecting(canvasId)); | ||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/siliconvalley/domain/google/dto/LabelResultDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.siliconvalley.domain.google.dto; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class LabelResultDto { | ||
|
||
private String label; | ||
private Float confidence;; | ||
|
||
public LabelResultDto(String label, Float confidence){ | ||
this.label = label; | ||
this.confidence = confidence; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/main/java/com/siliconvalley/domain/rabbitMQ/dto/DemoConversionRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.siliconvalley.domain.rabbitMQ.dto; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class DemoConversionRequest { | ||
private String sketchUrl; | ||
private String modelName; | ||
|
||
public DemoConversionRequest(String sketchUrl, String modelName){ | ||
this.sketchUrl = sketchUrl; | ||
this.modelName = modelName; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/siliconvalley/domain/rabbitMQ/dto/DemoConversionResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.siliconvalley.domain.rabbitMQ.dto; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class DemoConversionResponse { | ||
private String canvasUrl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
src/test/java/com/siliconvalley/post/EmotionServiceTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.siliconvalley.post; | ||
|
||
public class EmotionServiceTests { | ||
} |
63 changes: 63 additions & 0 deletions
63
src/test/java/com/siliconvalley/profile/ProfileNameServiceTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.siliconvalley.profile; | ||
|
||
import com.siliconvalley.domain.profile.dao.ProfileFindDao; | ||
import com.siliconvalley.domain.profile.exception.ProfileNameDuplicateException; | ||
import com.siliconvalley.domain.profile.exception.ProfileNameIncludeBadWordException; | ||
import com.siliconvalley.domain.profile.application.ProfileNameFilterService; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.InjectMocks; | ||
import org.mockito.Mock; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
|
||
import static org.mockito.Mockito.when; | ||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; | ||
|
||
@ExtendWith(MockitoExtension.class) | ||
@DisplayName("프로필 이름 생성 정책 테스트") | ||
public class ProfileNameServiceTests { | ||
|
||
@InjectMocks | ||
private ProfileNameFilterService profileNameFilterService; | ||
|
||
@Mock | ||
private ProfileFindDao profileFindDao; | ||
|
||
@Test | ||
@DisplayName("정책에 위반되지 않는 프로필 이름 생성") | ||
void 유효한_프로필_이름_테스트() { | ||
//given | ||
String 유효한프로필이름 = "유효한이름"; | ||
|
||
//when | ||
when(profileFindDao.existsByProfileName(유효한프로필이름)).thenReturn(false); | ||
|
||
//then | ||
assertDoesNotThrow(() -> profileNameFilterService.profileNameFilter(유효한프로필이름)); | ||
} | ||
|
||
@Test | ||
@DisplayName("프로필 이름에 부적절한 단어 포함 시 예외 발생") | ||
void 부적절한_단어_테스트() { | ||
//given | ||
String 부적절한단어포함프로필이름 = "지랄"; | ||
|
||
//then | ||
assertThrows(ProfileNameIncludeBadWordException.class, () -> profileNameFilterService.profileNameFilter(부적절한단어포함프로필이름)); | ||
} | ||
|
||
@Test | ||
@DisplayName("이미 사용 중인 프로필 이름 제공 시 예외 발생") | ||
void 중복_프로필_이름_테스트() { | ||
//given | ||
String 중복된프로필이름 = "중복이름"; | ||
|
||
//when | ||
when(profileFindDao.existsByProfileName(중복된프로필이름)).thenReturn(true); | ||
|
||
//then | ||
assertThrows(ProfileNameDuplicateException.class, () -> profileNameFilterService.profileNameFilter(중복된프로필이름)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters