Merge branch 'master' into master-web
# Conflicts: # src/main/java/com/mangkyu/employment/interview/app/quiz/service/QuizService.java
This commit is contained in:
@@ -3,7 +3,7 @@ package com.mangkyu.employment.interview.app.answer.controller;
|
||||
import com.mangkyu.employment.interview.app.answer.dto.AddAnswerRequest;
|
||||
import com.mangkyu.employment.interview.app.answer.dto.GetAnswerResponse;
|
||||
import com.mangkyu.employment.interview.app.answer.service.AnswerService;
|
||||
import com.mangkyu.employment.interview.app.common.erros.exception.QuizException;
|
||||
import com.mangkyu.employment.interview.erros.exception.RestApiException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -17,26 +17,26 @@ public class AnswerController {
|
||||
private final AnswerService answerService;
|
||||
|
||||
@PutMapping("/answer")
|
||||
public ResponseEntity<Void> putAnswer(@RequestBody @Valid final AddAnswerRequest addAnswerRequest) throws QuizException {
|
||||
public ResponseEntity<Void> putAnswer(@RequestBody @Valid final AddAnswerRequest addAnswerRequest) throws RestApiException {
|
||||
answerService.addAnswer(addAnswerRequest);
|
||||
return ResponseEntity.noContent()
|
||||
.build();
|
||||
}
|
||||
|
||||
@PostMapping("/answer")
|
||||
public ResponseEntity<Void> postAnswer(@RequestBody @Valid final AddAnswerRequest addAnswerRequest) throws QuizException {
|
||||
public ResponseEntity<Void> postAnswer(@RequestBody @Valid final AddAnswerRequest addAnswerRequest) throws RestApiException {
|
||||
answerService.addAnswer(addAnswerRequest);
|
||||
return ResponseEntity.noContent()
|
||||
.build();
|
||||
}
|
||||
|
||||
@GetMapping("/answer/{resourceId}")
|
||||
public ResponseEntity<GetAnswerResponse> getAnswer(@PathVariable final String resourceId) throws QuizException {
|
||||
public ResponseEntity<GetAnswerResponse> getAnswer(@PathVariable final String resourceId) throws RestApiException {
|
||||
return ResponseEntity.ok(answerService.getAnswer(resourceId));
|
||||
}
|
||||
|
||||
@DeleteMapping("/answer/{resourceId}")
|
||||
public ResponseEntity<Void> deleteAnswer(@PathVariable final String resourceId) throws QuizException {
|
||||
public ResponseEntity<Void> deleteAnswer(@PathVariable final String resourceId) throws RestApiException {
|
||||
answerService.deleteAnswer(resourceId);
|
||||
|
||||
return ResponseEntity.noContent().build();
|
||||
|
||||
@@ -4,9 +4,8 @@ import com.mangkyu.employment.interview.app.answer.dto.AddAnswerRequest;
|
||||
import com.mangkyu.employment.interview.app.answer.dto.GetAnswerResponse;
|
||||
import com.mangkyu.employment.interview.app.answer.entity.Answer;
|
||||
import com.mangkyu.employment.interview.app.answer.repository.AnswerRepository;
|
||||
import com.mangkyu.employment.interview.app.common.erros.errorcode.CommonErrorCode;
|
||||
import com.mangkyu.employment.interview.app.common.erros.errorcode.CustomErrorCode;
|
||||
import com.mangkyu.employment.interview.app.common.erros.exception.QuizException;
|
||||
import com.mangkyu.employment.interview.erros.errorcode.CommonErrorCode;
|
||||
import com.mangkyu.employment.interview.erros.exception.RestApiException;
|
||||
import com.mangkyu.employment.interview.app.quiz.converter.QuizDtoConverter;
|
||||
import com.mangkyu.employment.interview.app.quiz.entity.Quiz;
|
||||
import com.mangkyu.employment.interview.app.quiz.service.QuizService;
|
||||
@@ -22,15 +21,15 @@ public class AnswerService {
|
||||
private final QuizService quizService;
|
||||
private final AnswerRepository answerRepository;
|
||||
|
||||
public GetAnswerResponse getAnswer(final String resourceId) throws QuizException {
|
||||
public GetAnswerResponse getAnswer(final String resourceId) throws RestApiException {
|
||||
final Answer answer = answerRepository.findByResourceId(resourceId)
|
||||
.orElseThrow(() -> new QuizException(CommonErrorCode.RESOURCE_NOT_FOUND));
|
||||
.orElseThrow(() -> new RestApiException(CommonErrorCode.RESOURCE_NOT_FOUND));
|
||||
|
||||
return QuizDtoConverter.convert(answer);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void addAnswer(final AddAnswerRequest addAnswerRequest) throws QuizException {
|
||||
public void addAnswer(final AddAnswerRequest addAnswerRequest) throws RestApiException {
|
||||
final Quiz quiz = quizService.findQuiz(addAnswerRequest.getQuizResourceId());
|
||||
final Answer quizAnswer = quiz.getAnswer();
|
||||
if (quizAnswer == null) {
|
||||
@@ -43,9 +42,9 @@ public class AnswerService {
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void deleteAnswer(final String resourceId) throws QuizException {
|
||||
public void deleteAnswer(final String resourceId) throws RestApiException {
|
||||
final Answer answer = answerRepository.findByResourceId(resourceId)
|
||||
.orElseThrow(() -> new QuizException(CommonErrorCode.RESOURCE_NOT_FOUND));
|
||||
.orElseThrow(() -> new RestApiException(CommonErrorCode.RESOURCE_NOT_FOUND));
|
||||
answer.getQuiz().setAnswer(null);
|
||||
answerRepository.delete(answer);
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.mangkyu.employment.interview.app.common.erros.exception;
|
||||
|
||||
|
||||
import com.mangkyu.employment.interview.app.common.erros.errorcode.ErrorCode;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
public class QuizException extends RuntimeException {
|
||||
|
||||
private final ErrorCode errorCode;
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mangkyu.employment.interview.app.file.service;
|
||||
|
||||
import com.mangkyu.employment.interview.app.common.erros.errorcode.CommonErrorCode;
|
||||
import com.mangkyu.employment.interview.app.common.erros.exception.QuizException;
|
||||
import com.mangkyu.employment.interview.erros.errorcode.CommonErrorCode;
|
||||
import com.mangkyu.employment.interview.erros.exception.RestApiException;
|
||||
import com.mangkyu.employment.interview.app.file.dto.FileUploadResponse;
|
||||
import com.mangkyu.employment.interview.app.file.entity.MyFile;
|
||||
import com.mangkyu.employment.interview.app.file.repository.FileRepository;
|
||||
@@ -39,7 +39,7 @@ public class FileService {
|
||||
@PostConstruct
|
||||
public void init() throws IOException {
|
||||
if (StringUtils.isBlank(fileDirectory)) {
|
||||
throw new QuizException(CommonErrorCode.INTERNAL_SERVER_ERROR);
|
||||
throw new RestApiException(CommonErrorCode.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
final Path fileDirectoryPath = Paths.get(fileDirectory);
|
||||
@@ -76,14 +76,14 @@ public class FileService {
|
||||
|
||||
public Resource getFileAsResource(final String resourceId) {
|
||||
final MyFile myFile = fileRepository.findByResourceId(resourceId)
|
||||
.orElseThrow(() -> new QuizException(CommonErrorCode.RESOURCE_NOT_FOUND));
|
||||
.orElseThrow(() -> new RestApiException(CommonErrorCode.RESOURCE_NOT_FOUND));
|
||||
|
||||
try {
|
||||
final Path path = Paths.get(fileDirectory + myFile.getFileName());
|
||||
return new ByteArrayResource(Files.readAllBytes(path));
|
||||
} catch (final IOException e) {
|
||||
log.error("getFileAsResource Fail", e);
|
||||
throw new QuizException(CommonErrorCode.INTERNAL_SERVER_ERROR);
|
||||
throw new RestApiException(CommonErrorCode.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,6 @@ public final class QuizConstants {
|
||||
public static final int DEFAULT_PAGE_NUMBER = 0;
|
||||
public static final int MIN_PAGE_NUMBER = 0;
|
||||
public static final int MIN_PAGE_SIZE = 1;
|
||||
public static final int DEFAULT_PAGE_SIZE = 10;
|
||||
public static final int DEFAULT_PAGE_SIZE = 6;
|
||||
public static final int MAX_PAGE_SIZE = 30;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mangkyu.employment.interview.app.quiz.controller;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.mangkyu.employment.interview.app.common.erros.exception.QuizException;
|
||||
import com.mangkyu.employment.interview.erros.exception.RestApiException;
|
||||
import com.mangkyu.employment.interview.app.quiz.dto.*;
|
||||
import com.mangkyu.employment.interview.app.quiz.service.QuizService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -40,7 +40,7 @@ public class QuizController {
|
||||
}
|
||||
|
||||
@GetMapping("/quiz/{resourceId}")
|
||||
public ResponseEntity<GetQuizResponse> getQuiz(@PathVariable final String resourceId) throws QuizException {
|
||||
public ResponseEntity<GetQuizResponse> getQuiz(@PathVariable final String resourceId) throws RestApiException {
|
||||
return ResponseEntity.ok(quizService.getQuiz(resourceId));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package com.mangkyu.employment.interview.app.quiz.service;
|
||||
|
||||
import com.mangkyu.employment.interview.app.answer.repository.AnswerRepository;
|
||||
import com.mangkyu.employment.interview.app.common.erros.errorcode.CommonErrorCode;
|
||||
import com.mangkyu.employment.interview.app.common.erros.exception.QuizException;
|
||||
import com.mangkyu.employment.interview.erros.errorcode.CommonErrorCode;
|
||||
import com.mangkyu.employment.interview.erros.exception.RestApiException;
|
||||
import com.mangkyu.employment.interview.app.quiz.converter.QuizDtoConverter;
|
||||
import com.mangkyu.employment.interview.app.quiz.dto.*;
|
||||
import com.mangkyu.employment.interview.app.quiz.entity.Quiz;
|
||||
@@ -42,14 +41,12 @@ public class QuizService {
|
||||
quizRepository.save(quiz);
|
||||
}
|
||||
|
||||
public Quiz findQuiz(final String resourceId) throws QuizException {
|
||||
public Quiz findQuiz(final String resourceId) throws RestApiException {
|
||||
return quizRepository.findByResourceId(resourceId)
|
||||
.orElseThrow(() -> new QuizException(CommonErrorCode.RESOURCE_NOT_FOUND));
|
||||
.orElseThrow(() -> new RestApiException(CommonErrorCode.RESOURCE_NOT_FOUND));
|
||||
}
|
||||
|
||||
private final AnswerRepository answerRepository;
|
||||
|
||||
public GetQuizResponse getQuiz(final String resourceId) throws QuizException {
|
||||
public GetQuizResponse getQuiz(final String resourceId) throws RestApiException {
|
||||
final Quiz quiz = findQuiz(resourceId);
|
||||
return QuizDtoConverter.convert(quiz, enumMapperFactory.getElement(EnumMapperKey.QUIZ_CATEGORY, quiz.getQuizCategory()));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mangkyu.employment.interview.app.common.erros.errorcode;
|
||||
package com.mangkyu.employment.interview.erros.errorcode;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mangkyu.employment.interview.app.common.erros.errorcode;
|
||||
package com.mangkyu.employment.interview.erros.errorcode;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mangkyu.employment.interview.app.common.erros.errorcode;
|
||||
package com.mangkyu.employment.interview.erros.errorcode;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.mangkyu.employment.interview.erros.exception;
|
||||
|
||||
|
||||
import com.mangkyu.employment.interview.erros.errorcode.ErrorCode;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
public class RestApiException extends RuntimeException {
|
||||
|
||||
private final ErrorCode errorCode;
|
||||
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.mangkyu.employment.interview.app.common.erros.handler;
|
||||
package com.mangkyu.employment.interview.erros.handler;
|
||||
|
||||
import com.mangkyu.employment.interview.app.common.erros.errorcode.CommonErrorCode;
|
||||
import com.mangkyu.employment.interview.app.common.erros.errorcode.ErrorCode;
|
||||
import com.mangkyu.employment.interview.app.common.erros.exception.QuizException;
|
||||
import com.mangkyu.employment.interview.app.common.erros.response.ErrorResponse;
|
||||
import com.mangkyu.employment.interview.erros.errorcode.CommonErrorCode;
|
||||
import com.mangkyu.employment.interview.erros.errorcode.ErrorCode;
|
||||
import com.mangkyu.employment.interview.erros.exception.RestApiException;
|
||||
import com.mangkyu.employment.interview.erros.response.ErrorResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -22,8 +22,8 @@ import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
|
||||
|
||||
@ExceptionHandler(QuizException.class)
|
||||
public ResponseEntity<Object> handleQuizException(final QuizException e) {
|
||||
@ExceptionHandler(RestApiException.class)
|
||||
public ResponseEntity<Object> handleQuizException(final RestApiException e) {
|
||||
final ErrorCode errorCode = e.getErrorCode();
|
||||
return handleExceptionInternal(errorCode);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mangkyu.employment.interview.app.common.erros.response;
|
||||
package com.mangkyu.employment.interview.erros.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Builder;
|
||||
@@ -1,5 +1,5 @@
|
||||
# Custom
|
||||
file.directory=/c/Users/Mang/IdeaProjects/InterviewSubscription/images/
|
||||
file.directory=C:\\Users\\Mang\\IdeaProjects\\InterviewSubscription\\images\\
|
||||
|
||||
# Datasource
|
||||
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
|
||||
|
||||
@@ -4,8 +4,8 @@ import com.mangkyu.employment.interview.app.answer.dto.AddAnswerRequest;
|
||||
import com.mangkyu.employment.interview.app.answer.dto.GetAnswerResponse;
|
||||
import com.mangkyu.employment.interview.app.answer.entity.Answer;
|
||||
import com.mangkyu.employment.interview.app.answer.repository.AnswerRepository;
|
||||
import com.mangkyu.employment.interview.app.common.erros.errorcode.CommonErrorCode;
|
||||
import com.mangkyu.employment.interview.app.common.erros.exception.QuizException;
|
||||
import com.mangkyu.employment.interview.erros.errorcode.CommonErrorCode;
|
||||
import com.mangkyu.employment.interview.erros.exception.RestApiException;
|
||||
import com.mangkyu.employment.interview.app.quiz.entity.Quiz;
|
||||
import com.mangkyu.employment.interview.app.quiz.service.QuizService;
|
||||
import com.mangkyu.employment.interview.testutils.EntityCreationUtils;
|
||||
@@ -35,7 +35,7 @@ class AnswerServiceTest {
|
||||
private AnswerRepository answerRepository;
|
||||
|
||||
@Test
|
||||
public void addAnswerSuccess_Modify() throws QuizException {
|
||||
public void addAnswerSuccess_Modify() throws RestApiException {
|
||||
// given
|
||||
final AddAnswerRequest addAnswerRequest = AddAnswerRequest.builder()
|
||||
.quizResourceId(UUID.randomUUID().toString())
|
||||
@@ -57,7 +57,7 @@ class AnswerServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addAnswerSuccess_Insert() throws QuizException {
|
||||
public void addAnswerSuccess_Insert() throws RestApiException {
|
||||
// given
|
||||
final AddAnswerRequest addAnswerRequest = AddAnswerRequest.builder()
|
||||
.quizResourceId(UUID.randomUUID().toString())
|
||||
@@ -81,14 +81,14 @@ class AnswerServiceTest {
|
||||
doReturn(Optional.empty()).when(answerRepository).findByResourceId(resourceId);
|
||||
|
||||
// when
|
||||
final QuizException result = assertThrows(QuizException.class, () -> answerService.getAnswer(resourceId));
|
||||
final RestApiException result = assertThrows(RestApiException.class, () -> answerService.getAnswer(resourceId));
|
||||
|
||||
// then
|
||||
assertThat(result.getErrorCode()).isEqualTo(CommonErrorCode.RESOURCE_NOT_FOUND);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAnswerByQuizResourceIdSuccess() throws QuizException {
|
||||
public void getAnswerByQuizResourceIdSuccess() throws RestApiException {
|
||||
// given
|
||||
final Quiz quiz = EntityCreationUtils.quiz();
|
||||
final Answer answer = EntityCreationUtils.answer(quiz);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mangkyu.employment.interview.app.file.service;
|
||||
|
||||
import com.mangkyu.employment.interview.app.common.erros.errorcode.CommonErrorCode;
|
||||
import com.mangkyu.employment.interview.app.common.erros.exception.QuizException;
|
||||
import com.mangkyu.employment.interview.erros.errorcode.CommonErrorCode;
|
||||
import com.mangkyu.employment.interview.erros.exception.RestApiException;
|
||||
import com.mangkyu.employment.interview.app.file.dto.FileUploadResponse;
|
||||
import com.mangkyu.employment.interview.app.file.entity.MyFile;
|
||||
import com.mangkyu.employment.interview.app.file.repository.FileRepository;
|
||||
@@ -41,7 +41,7 @@ class FileServiceTest {
|
||||
// given
|
||||
|
||||
// when
|
||||
final QuizException result = assertThrows(QuizException.class, () -> target.init());
|
||||
final RestApiException result = assertThrows(RestApiException.class, () -> target.init());
|
||||
|
||||
// then
|
||||
assertThat(result.getErrorCode()).isEqualTo(CommonErrorCode.INTERNAL_SERVER_ERROR);
|
||||
@@ -124,7 +124,7 @@ class FileServiceTest {
|
||||
doReturn(Optional.empty()).when(fileRepository).findByResourceId(resourceId);
|
||||
|
||||
// when
|
||||
final QuizException result = assertThrows(QuizException.class, () -> target.getFileAsResource(resourceId));
|
||||
final RestApiException result = assertThrows(RestApiException.class, () -> target.getFileAsResource(resourceId));
|
||||
|
||||
// then
|
||||
assertThat(result.getErrorCode()).isEqualTo(CommonErrorCode.RESOURCE_NOT_FOUND);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mangkyu.employment.interview.app.quiz.service;
|
||||
|
||||
import com.mangkyu.employment.interview.app.common.erros.errorcode.CommonErrorCode;
|
||||
import com.mangkyu.employment.interview.app.common.erros.exception.QuizException;
|
||||
import com.mangkyu.employment.interview.erros.errorcode.CommonErrorCode;
|
||||
import com.mangkyu.employment.interview.erros.exception.RestApiException;
|
||||
import com.mangkyu.employment.interview.app.quiz.dto.*;
|
||||
import com.mangkyu.employment.interview.app.quiz.entity.Quiz;
|
||||
import com.mangkyu.employment.interview.app.quiz.repository.QuizRepository;
|
||||
@@ -88,14 +88,14 @@ class QuizServiceTest {
|
||||
doReturn(Optional.empty()).when(quizRepository).findByResourceId(quiz.getResourceId());
|
||||
|
||||
// when
|
||||
final QuizException result = assertThrows(QuizException.class, () -> quizService.findQuiz(quiz.getResourceId()));
|
||||
final RestApiException result = assertThrows(RestApiException.class, () -> quizService.findQuiz(quiz.getResourceId()));
|
||||
|
||||
// then
|
||||
assertThat(result.getErrorCode()).isEqualTo(CommonErrorCode.RESOURCE_NOT_FOUND);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findQuizEntitySuccess() throws QuizException {
|
||||
public void findQuizEntitySuccess() throws RestApiException {
|
||||
// given
|
||||
final long id = -1L;
|
||||
final Quiz quiz = quiz(id);
|
||||
@@ -119,14 +119,14 @@ class QuizServiceTest {
|
||||
doReturn(Optional.empty()).when(quizRepository).findByResourceId(quiz.getResourceId());
|
||||
|
||||
// when
|
||||
final QuizException result = assertThrows(QuizException.class, () -> quizService.getQuiz(quiz.getResourceId()));
|
||||
final RestApiException result = assertThrows(RestApiException.class, () -> quizService.getQuiz(quiz.getResourceId()));
|
||||
|
||||
// then
|
||||
assertThat(result.getErrorCode()).isEqualTo(CommonErrorCode.RESOURCE_NOT_FOUND);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getQuizSuccess() throws QuizException {
|
||||
public void getQuizSuccess() throws RestApiException {
|
||||
// given
|
||||
final long id = -1L;
|
||||
final Quiz quiz = quiz(id);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.mangkyu.employment.interview.app.common.erros.handler;
|
||||
package com.mangkyu.employment.interview.erros.handler;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.mangkyu.employment.interview.app.common.erros.errorcode.CommonErrorCode;
|
||||
import com.mangkyu.employment.interview.app.common.erros.errorcode.ErrorCode;
|
||||
import com.mangkyu.employment.interview.app.common.erros.response.ErrorResponse;
|
||||
import com.mangkyu.employment.interview.app.common.erros.exception.QuizException;
|
||||
import com.mangkyu.employment.interview.erros.errorcode.CommonErrorCode;
|
||||
import com.mangkyu.employment.interview.erros.errorcode.ErrorCode;
|
||||
import com.mangkyu.employment.interview.erros.response.ErrorResponse;
|
||||
import com.mangkyu.employment.interview.erros.exception.RestApiException;
|
||||
import com.mangkyu.employment.interview.app.quiz.controller.QuizController;
|
||||
import com.mangkyu.employment.interview.app.quiz.dto.AddQuizRequest;
|
||||
import com.mangkyu.employment.interview.app.quiz.service.QuizService;
|
||||
@@ -58,7 +58,7 @@ class GlobalExceptionHandlerTest {
|
||||
final String url = "/quiz/" + resourceId;
|
||||
final ErrorCode errorCode = CommonErrorCode.RESOURCE_NOT_FOUND;
|
||||
|
||||
doThrow(new QuizException(errorCode)).when(quizService).getQuiz(resourceId);
|
||||
doThrow(new RestApiException(errorCode)).when(quizService).getQuiz(resourceId);
|
||||
|
||||
// when
|
||||
final ResultActions result = mockMvc.perform(
|
||||
Reference in New Issue
Block a user