Skip to content

Commit

Permalink
refact(#75) : MessageUseCase 사용
Browse files Browse the repository at this point in the history
- SendMessageService를 사용하던 코드들을 SendMessageUseCase를 사용하도록 변환했어요.
  • Loading branch information
jyj1289 committed May 9, 2024
1 parent b67cec0 commit de4965e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.bamdoliro.maru.presentation.message;

import com.bamdoliro.maru.application.message.SendMessageUseCase;
import com.bamdoliro.maru.domain.user.domain.User;
import com.bamdoliro.maru.infrastructure.message.SendMessageService;
import com.bamdoliro.maru.presentation.message.dto.request.SendMessageRequest;
Expand All @@ -15,14 +16,14 @@
@RestController
public class MessageController {

private final SendMessageService messageService;
private final SendMessageUseCase sendMessageUseCase;

@ResponseStatus(HttpStatus.NO_CONTENT)
@PostMapping
public void sendMessage(
@AuthenticationPrincipal(authority = Authority.ADMIN) User user,
@RequestBody @Valid SendMessageRequest request
) {
messageService.execute(request);
sendMessageUseCase.execute(request);
}
}
17 changes: 4 additions & 13 deletions src/test/java/com/bamdoliro/maru/shared/util/ControllerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.bamdoliro.maru.application.form.UpdateSecondRoundScoreUseCase;
import com.bamdoliro.maru.application.form.UploadFormUseCase;
import com.bamdoliro.maru.application.form.UploadIdentificationPictureUseCase;
import com.bamdoliro.maru.application.message.SendMessageUseCase;
import com.bamdoliro.maru.application.notice.CreateNoticeUseCase;
import com.bamdoliro.maru.application.notice.DeleteNoticeUseCase;
import com.bamdoliro.maru.application.notice.QueryNoticeListUseCase;
Expand Down Expand Up @@ -73,18 +74,7 @@
import org.springframework.test.web.servlet.MockMvc;

@Disabled
@WebMvcTest({
UserController.class,
AuthController.class,
SharedController.class,
SchoolController.class,
QuestionController.class,
FormController.class,
NoticeController.class,
DraftFormController.class,
FairController.class,
MessageController.class
})
@WebMvcTest({UserController.class, AuthController.class, SharedController.class, SchoolController.class, QuestionController.class, FormController.class, NoticeController.class, DraftFormController.class, FairController.class, MessageController.class})
public abstract class ControllerTest {

@Autowired
Expand Down Expand Up @@ -238,7 +228,6 @@ public abstract class ControllerTest {
@MockBean
protected QueryFormUrlUseCase queryFormUrlUseCase;


@MockBean
protected TokenService tokenService;

Expand All @@ -248,6 +237,8 @@ public abstract class ControllerTest {
@MockBean
protected SendMessageService sendMessageService;

@MockBean
protected SendMessageUseCase sendMessageUseCase;

@MockBean
protected JwtProperties jwtProperties;
Expand Down

0 comments on commit de4965e

Please sign in to comment.