Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

상세 조회 컨트롤러 테스트 시 ReadResDTO 생성자에 수정 시간 추가 #147

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void findAll_security_filter_test() throws Exception {
// given

// QueryParmas
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
map.add("leftLng", "30.0");
map.add("leftLat", "30.0");
map.add("rightLng", "40.0");
Expand All @@ -81,7 +81,6 @@ public void findAll_security_filter_test() throws Exception {
.totalPages(1)
.build();


Mockito.when(docsReadService.getDocsList(any(), any())).thenReturn(docsList);

// when
Expand Down Expand Up @@ -118,7 +117,10 @@ public void findById_test() throws Exception {

// stub
Mockito.when(docsReadService.getOneDocs(eq(docsId))).thenReturn(
new ReadResDTO(1L, "내용1", DocsCategory.CONV.getCategory(), new DocsLocation(13.1, 34.3), "1nuu", member.getNickName(), LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")),true)
new ReadResDTO(1L, "내용1", DocsCategory.CONV.getCategory(), new DocsLocation(13.1, 34.3), "1nuu",
member.getNickName(),
LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")),
LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")), true)
);

// when
Expand All @@ -135,9 +137,9 @@ public void findById_test() throws Exception {
}

@DisplayName("문서 수정")
@WithMockUser(username = "[email protected]",roles = "USER")
@WithMockUser(username = "[email protected]", roles = "USER")
@Test
public void docs_update_test() throws Exception{
public void docs_update_test() throws Exception {
// given
Long docsId = 1L;
String docsContent = "수정된 문서내용";
Expand Down Expand Up @@ -177,9 +179,9 @@ public void docs_update_test() throws Exception{
}

@DisplayName("문서 검색")
@WithMockUser(username = "[email protected]",roles = "USER")
@WithMockUser(username = "[email protected]", roles = "USER")
@Test
public void docs_search_test() throws Exception{
public void docs_search_test() throws Exception {
// given
String search = "검색";
MultiValueMap<String, String> queryParam = new LinkedMultiValueMap<>();
Expand All @@ -196,7 +198,7 @@ public void docs_search_test() throws Exception{
Mockito.when(
docsReadService.searchLike(search)
).thenReturn(
dtoList
dtoList
);

// when
Expand All @@ -208,8 +210,6 @@ public void docs_search_test() throws Exception{
.characterEncoding(StandardCharsets.UTF_8)
);



// then
String res = resultActions.andReturn().getResponse().getContentAsString();
System.out.println("테스트 : " + res);
Expand All @@ -223,4 +223,4 @@ public void docs_search_test() throws Exception{
}


}
}
Loading