diff --git a/backend/src/main/java/com/dragonguard/backend/domain/admin/controller/AdminController.java b/backend/src/main/java/com/dragonguard/backend/domain/admin/controller/AdminController.java index f0444e82..2b2050b6 100644 --- a/backend/src/main/java/com/dragonguard/backend/domain/admin/controller/AdminController.java +++ b/backend/src/main/java/com/dragonguard/backend/domain/admin/controller/AdminController.java @@ -2,7 +2,7 @@ import com.dragonguard.backend.domain.admin.annotation.Admin; import com.dragonguard.backend.domain.admin.dto.request.AdminDecideRequest; -import com.dragonguard.backend.domain.admin.dto.response.AdminOrganizationResponse; +import com.dragonguard.backend.domain.admin.dto.response.AdminOrganizationResponses; import com.dragonguard.backend.domain.admin.service.AdminService; import com.dragonguard.backend.domain.organization.entity.OrganizationStatus; @@ -12,8 +12,6 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; -import java.util.List; - import javax.validation.Valid; /** @@ -35,14 +33,14 @@ public ResponseEntity checkAdmin() { /** 조직 승인 요청에 대해 관리자의 선택에 대한 요청을 받는 api */ @PostMapping("/organizations/decide") - public ResponseEntity> decideRequest( + public ResponseEntity decideRequest( @RequestBody @Valid final AdminDecideRequest adminDecideRequest) { return ResponseEntity.ok(adminService.decideRequestedOrganization(adminDecideRequest)); } /** 조직의 승인 여부에 따른 조회 */ @GetMapping("/organizations") - public ResponseEntity> getOrganizationsByStatus( + public ResponseEntity getOrganizationsByStatus( @RequestParam final OrganizationStatus status, final Pageable pageable) { return ResponseEntity.ok(adminService.findOrganizationsByStatus(status, pageable)); } diff --git a/backend/src/main/java/com/dragonguard/backend/domain/admin/dto/response/AdminOrganizationResponses.java b/backend/src/main/java/com/dragonguard/backend/domain/admin/dto/response/AdminOrganizationResponses.java new file mode 100644 index 00000000..f506103d --- /dev/null +++ b/backend/src/main/java/com/dragonguard/backend/domain/admin/dto/response/AdminOrganizationResponses.java @@ -0,0 +1,14 @@ +package com.dragonguard.backend.domain.admin.dto.response; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Getter +@NoArgsConstructor +@AllArgsConstructor +public class AdminOrganizationResponses { + private List data; +} diff --git a/backend/src/main/java/com/dragonguard/backend/domain/admin/service/AdminService.java b/backend/src/main/java/com/dragonguard/backend/domain/admin/service/AdminService.java index 790904c0..0d8b5b06 100644 --- a/backend/src/main/java/com/dragonguard/backend/domain/admin/service/AdminService.java +++ b/backend/src/main/java/com/dragonguard/backend/domain/admin/service/AdminService.java @@ -1,7 +1,7 @@ package com.dragonguard.backend.domain.admin.service; import com.dragonguard.backend.domain.admin.dto.request.AdminDecideRequest; -import com.dragonguard.backend.domain.admin.dto.response.AdminOrganizationResponse; +import com.dragonguard.backend.domain.admin.dto.response.AdminOrganizationResponses; import com.dragonguard.backend.domain.admin.mapper.AdminMapper; import com.dragonguard.backend.domain.organization.entity.Organization; import com.dragonguard.backend.domain.organization.entity.OrganizationStatus; @@ -29,7 +29,7 @@ public class AdminService { private final OrganizationRepository organizationRepository; private final AdminMapper adminMapper; - public List decideRequestedOrganization( + public AdminOrganizationResponses decideRequestedOrganization( final AdminDecideRequest adminDecideRequest) { final Organization organization = getOrganization(adminDecideRequest); final OrganizationStatus beforeStatus = organization.getOrganizationStatus(); @@ -39,7 +39,7 @@ public List decideRequestedOrganization( organizationRepository.findAllByOrganizationStatus( beforeStatus, PageRequest.of(DEFAULT_PAGE, DEFAULT_PAGE_SIZE)); - return adminMapper.toResponseList(organizations); + return new AdminOrganizationResponses(adminMapper.toResponseList(organizations)); } private Organization getOrganization(final AdminDecideRequest adminDecideRequest) { @@ -49,11 +49,11 @@ private Organization getOrganization(final AdminDecideRequest adminDecideRequest } @Transactional(readOnly = true) - public List findOrganizationsByStatus( + public AdminOrganizationResponses findOrganizationsByStatus( final OrganizationStatus status, final Pageable pageable) { List organizations = organizationRepository.findAllByOrganizationStatus(status, pageable); - return adminMapper.toResponseList(organizations); + return new AdminOrganizationResponses(adminMapper.toResponseList(organizations)); } } diff --git a/backend/src/main/java/com/dragonguard/backend/domain/blockchain/controller/BlockchainController.java b/backend/src/main/java/com/dragonguard/backend/domain/blockchain/controller/BlockchainController.java index db049cef..ed5b61c2 100644 --- a/backend/src/main/java/com/dragonguard/backend/domain/blockchain/controller/BlockchainController.java +++ b/backend/src/main/java/com/dragonguard/backend/domain/blockchain/controller/BlockchainController.java @@ -1,6 +1,6 @@ package com.dragonguard.backend.domain.blockchain.controller; -import com.dragonguard.backend.domain.blockchain.dto.response.BlockchainResponse; +import com.dragonguard.backend.domain.blockchain.dto.response.BlockchainResponses; import com.dragonguard.backend.domain.blockchain.service.BlockchainService; import lombok.RequiredArgsConstructor; @@ -10,8 +10,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import java.util.List; - /** * @author 김승진 * @description 블록체인 관련 요청을 처리하는 컨트롤러 @@ -24,7 +22,7 @@ public class BlockchainController { /** 블록체인 부여 내역을 조회하는 api */ @GetMapping - public ResponseEntity> getBlockchainInfo() { + public ResponseEntity getBlockchainInfo() { return ResponseEntity.ok(blockchainService.getBlockchainList()); } } diff --git a/backend/src/main/java/com/dragonguard/backend/domain/blockchain/dto/response/BlockchainResponses.java b/backend/src/main/java/com/dragonguard/backend/domain/blockchain/dto/response/BlockchainResponses.java new file mode 100644 index 00000000..b632a6b5 --- /dev/null +++ b/backend/src/main/java/com/dragonguard/backend/domain/blockchain/dto/response/BlockchainResponses.java @@ -0,0 +1,14 @@ +package com.dragonguard.backend.domain.blockchain.dto.response; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Getter +@NoArgsConstructor +@AllArgsConstructor +public class BlockchainResponses { + private List data; +} diff --git a/backend/src/main/java/com/dragonguard/backend/domain/blockchain/service/BlockchainService.java b/backend/src/main/java/com/dragonguard/backend/domain/blockchain/service/BlockchainService.java index 0efb4c23..f897c066 100644 --- a/backend/src/main/java/com/dragonguard/backend/domain/blockchain/service/BlockchainService.java +++ b/backend/src/main/java/com/dragonguard/backend/domain/blockchain/service/BlockchainService.java @@ -1,6 +1,7 @@ package com.dragonguard.backend.domain.blockchain.service; import com.dragonguard.backend.domain.blockchain.dto.response.BlockchainResponse; +import com.dragonguard.backend.domain.blockchain.dto.response.BlockchainResponses; import com.dragonguard.backend.domain.blockchain.entity.Blockchain; import com.dragonguard.backend.domain.blockchain.entity.ContributeType; import com.dragonguard.backend.domain.blockchain.mapper.BlockchainMapper; @@ -73,9 +74,9 @@ private String transferTransaction( } @Transactional(readOnly = true) - public List getBlockchainList() { + public BlockchainResponses getBlockchainList() { final UUID memberId = authService.getLoginUserId(); - return getBlockchainResponses(memberId); + return new BlockchainResponses(getBlockchainResponses(memberId)); } private List getBlockchainResponses(final UUID memberId) { diff --git a/backend/src/main/java/com/dragonguard/backend/domain/organization/controller/OrganizationController.java b/backend/src/main/java/com/dragonguard/backend/domain/organization/controller/OrganizationController.java index 7be37923..0653d771 100644 --- a/backend/src/main/java/com/dragonguard/backend/domain/organization/controller/OrganizationController.java +++ b/backend/src/main/java/com/dragonguard/backend/domain/organization/controller/OrganizationController.java @@ -2,7 +2,7 @@ import com.dragonguard.backend.domain.organization.dto.request.AddMemberRequest; import com.dragonguard.backend.domain.organization.dto.request.OrganizationRequest; -import com.dragonguard.backend.domain.organization.dto.response.OrganizationResponse; +import com.dragonguard.backend.domain.organization.dto.response.OrganizationResponses; import com.dragonguard.backend.domain.organization.entity.OrganizationType; import com.dragonguard.backend.domain.organization.service.OrganizationEmailFacade; import com.dragonguard.backend.global.dto.IdResponse; @@ -13,8 +13,6 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; -import java.util.List; - import javax.validation.Valid; /** @@ -49,27 +47,27 @@ public ResponseEntity> addMemberToOrganization( /** 조직 타입별 조회 api */ @GetMapping - public ResponseEntity> getOrganizations( + public ResponseEntity getOrganizations( @RequestParam final OrganizationType type, final Pageable pageable) { return ResponseEntity.ok(organizationService.findByType(type, pageable)); } /** 조직 자체의 랭킹을 페이징을 통해 조회하는 api */ @GetMapping("/ranking/all") - public ResponseEntity> getOrganizationRank(final Pageable pageable) { + public ResponseEntity getOrganizationRank(final Pageable pageable) { return ResponseEntity.ok(organizationService.getOrganizationRank(pageable)); } /** 조직의 타입별 랭킹을 페이징을 통해 조회하는 api */ @GetMapping("/ranking") - public ResponseEntity> getOrganizationRankByType( + public ResponseEntity getOrganizationRankByType( @RequestParam final OrganizationType type, final Pageable pageable) { return ResponseEntity.ok(organizationService.getOrganizationRankByType(type, pageable)); } /** 조직을 이름으로 검색하는 api */ @GetMapping("/search") - public ResponseEntity> searchOrganization( + public ResponseEntity searchOrganization( @RequestParam final OrganizationType type, @RequestParam final String name, final Pageable pageable) { diff --git a/backend/src/main/java/com/dragonguard/backend/domain/organization/dto/response/OrganizationResponses.java b/backend/src/main/java/com/dragonguard/backend/domain/organization/dto/response/OrganizationResponses.java new file mode 100644 index 00000000..9051a5f5 --- /dev/null +++ b/backend/src/main/java/com/dragonguard/backend/domain/organization/dto/response/OrganizationResponses.java @@ -0,0 +1,14 @@ +package com.dragonguard.backend.domain.organization.dto.response; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Getter +@NoArgsConstructor +@AllArgsConstructor +public class OrganizationResponses { + private List data; +} diff --git a/backend/src/main/java/com/dragonguard/backend/domain/organization/service/OrganizationEmailFacade.java b/backend/src/main/java/com/dragonguard/backend/domain/organization/service/OrganizationEmailFacade.java index ac249b1b..40c4f86f 100644 --- a/backend/src/main/java/com/dragonguard/backend/domain/organization/service/OrganizationEmailFacade.java +++ b/backend/src/main/java/com/dragonguard/backend/domain/organization/service/OrganizationEmailFacade.java @@ -8,16 +8,16 @@ import com.dragonguard.backend.domain.member.service.AuthService; import com.dragonguard.backend.domain.organization.dto.request.AddMemberRequest; import com.dragonguard.backend.domain.organization.dto.request.OrganizationRequest; -import com.dragonguard.backend.domain.organization.dto.response.OrganizationResponse; +import com.dragonguard.backend.domain.organization.dto.response.OrganizationResponses; import com.dragonguard.backend.domain.organization.entity.Organization; import com.dragonguard.backend.domain.organization.entity.OrganizationType; import com.dragonguard.backend.global.annotation.TransactionService; import com.dragonguard.backend.global.dto.IdResponse; import com.dragonguard.backend.global.template.service.EntityLoader; + import lombok.RequiredArgsConstructor; -import org.springframework.data.domain.Pageable; -import java.util.List; +import org.springframework.data.domain.Pageable; /** * @author 김승진 @@ -59,23 +59,26 @@ public IdResponse saveOrganization(final OrganizationRequest organizationR return organizationService.saveOrganization(organizationRequest); } - public List findByType( + public OrganizationResponses findByType( final OrganizationType organizationType, final Pageable pageable) { - return organizationService.findByType(organizationType, pageable); + return new OrganizationResponses( + organizationService.findByType(organizationType, pageable)); } - public List getOrganizationRank(final Pageable pageable) { - return organizationService.findOrganizationRank(pageable); + public OrganizationResponses getOrganizationRank(final Pageable pageable) { + return new OrganizationResponses(organizationService.findOrganizationRank(pageable)); } - public List getOrganizationRankByType( + public OrganizationResponses getOrganizationRankByType( final OrganizationType type, final Pageable pageable) { - return organizationService.findOrganizationRankByType(type, pageable); + return new OrganizationResponses( + organizationService.findOrganizationRankByType(type, pageable)); } - public List searchOrganization( + public OrganizationResponses searchOrganization( final OrganizationType type, final String name, final Pageable pageable) { - return organizationService.searchOrganization(type, name, pageable); + return new OrganizationResponses( + organizationService.searchOrganization(type, name, pageable)); } public IdResponse getByName(final String name) { diff --git a/backend/src/main/java/com/dragonguard/backend/domain/search/controller/SearchController.java b/backend/src/main/java/com/dragonguard/backend/domain/search/controller/SearchController.java index 7eb8fb72..c60b254b 100644 --- a/backend/src/main/java/com/dragonguard/backend/domain/search/controller/SearchController.java +++ b/backend/src/main/java/com/dragonguard/backend/domain/search/controller/SearchController.java @@ -1,7 +1,7 @@ package com.dragonguard.backend.domain.search.controller; -import com.dragonguard.backend.domain.search.dto.response.GitRepoResultResponse; -import com.dragonguard.backend.domain.search.dto.response.UserResultSearchResponse; +import com.dragonguard.backend.domain.search.dto.response.GitRepoResultResponses; +import com.dragonguard.backend.domain.search.dto.response.UserResultSearchResponses; import com.dragonguard.backend.domain.search.service.SearchResultFacade; import lombok.RequiredArgsConstructor; @@ -26,14 +26,14 @@ public class SearchController { /** 깃허브 유저를 이름으로 검색하는 api */ @GetMapping(params = "type=USERS") - public ResponseEntity> getUsersSearchResult( + public ResponseEntity getUsersSearchResult( @RequestParam final String name, @RequestParam final Integer page) { return ResponseEntity.ok(searchService.getUserSearchResultByClient(name, page)); } /** 깃허브 repository를 이름으로 검색하는 api */ @GetMapping(params = "type=REPOSITORIES") - public ResponseEntity> getReposSearchResult( + public ResponseEntity getReposSearchResult( @RequestParam(value = "filters", required = false) final List filters, @RequestParam final String name, @RequestParam final Integer page) { diff --git a/backend/src/main/java/com/dragonguard/backend/domain/search/dto/response/GitRepoResultResponses.java b/backend/src/main/java/com/dragonguard/backend/domain/search/dto/response/GitRepoResultResponses.java new file mode 100644 index 00000000..d76f40c6 --- /dev/null +++ b/backend/src/main/java/com/dragonguard/backend/domain/search/dto/response/GitRepoResultResponses.java @@ -0,0 +1,14 @@ +package com.dragonguard.backend.domain.search.dto.response; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Getter +@NoArgsConstructor +@AllArgsConstructor +public class GitRepoResultResponses { + private List data; +} diff --git a/backend/src/main/java/com/dragonguard/backend/domain/search/dto/response/UserResultSearchResponses.java b/backend/src/main/java/com/dragonguard/backend/domain/search/dto/response/UserResultSearchResponses.java new file mode 100644 index 00000000..df2c7a9d --- /dev/null +++ b/backend/src/main/java/com/dragonguard/backend/domain/search/dto/response/UserResultSearchResponses.java @@ -0,0 +1,14 @@ +package com.dragonguard.backend.domain.search.dto.response; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Getter +@NoArgsConstructor +@AllArgsConstructor +public class UserResultSearchResponses { + private List data; +} diff --git a/backend/src/main/java/com/dragonguard/backend/domain/search/service/SearchResultFacade.java b/backend/src/main/java/com/dragonguard/backend/domain/search/service/SearchResultFacade.java index b1481383..6c1c3746 100644 --- a/backend/src/main/java/com/dragonguard/backend/domain/search/service/SearchResultFacade.java +++ b/backend/src/main/java/com/dragonguard/backend/domain/search/service/SearchResultFacade.java @@ -9,7 +9,9 @@ import com.dragonguard.backend.domain.search.dto.kafka.ScrapeResult; import com.dragonguard.backend.domain.search.dto.request.SearchRequest; import com.dragonguard.backend.domain.search.dto.response.GitRepoResultResponse; +import com.dragonguard.backend.domain.search.dto.response.GitRepoResultResponses; import com.dragonguard.backend.domain.search.dto.response.UserResultSearchResponse; +import com.dragonguard.backend.domain.search.dto.response.UserResultSearchResponses; import com.dragonguard.backend.domain.search.entity.Search; import com.dragonguard.backend.domain.search.entity.SearchType; import com.dragonguard.backend.global.annotation.TransactionService; @@ -53,19 +55,19 @@ public void saveAllResult(final List results, final SearchRequest resultService.saveAllResultsWithSearch(results, searchId, resultList); } - public List getUserSearchResultByClient( + public UserResultSearchResponses getUserSearchResultByClient( final String name, final Integer page) { final SearchRequest searchRequest = new SearchRequest(name, SearchType.USERS, page); final Search search = getSearch(searchRequest); - return searchUser(searchRequest, search); + return new UserResultSearchResponses(searchUser(searchRequest, search)); } - public List getGitRepoSearchResultByClient( + public GitRepoResultResponses getGitRepoSearchResultByClient( final String name, final Integer page, final List filters) { final SearchRequest searchRequest = new SearchRequest(name, SearchType.REPOSITORIES, page, filters); final Search search = getSearch(searchRequest); - return searchRepo(searchRequest, search); + return new GitRepoResultResponses(searchRepo(searchRequest, search)); } private Search getSearch(final SearchRequest searchRequest) { diff --git a/backend/src/test/java/com/dragonguard/backend/domain/admin/controller/AdminControllerTest.java b/backend/src/test/java/com/dragonguard/backend/domain/admin/controller/AdminControllerTest.java index d90a1b96..5bafaf14 100644 --- a/backend/src/test/java/com/dragonguard/backend/domain/admin/controller/AdminControllerTest.java +++ b/backend/src/test/java/com/dragonguard/backend/domain/admin/controller/AdminControllerTest.java @@ -9,11 +9,11 @@ import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import com.dragonguard.backend.domain.admin.dto.request.AdminDecideRequest; import com.dragonguard.backend.domain.admin.dto.response.AdminOrganizationResponse; +import com.dragonguard.backend.domain.admin.dto.response.AdminOrganizationResponses; import com.dragonguard.backend.domain.admin.service.AdminService; import com.dragonguard.backend.domain.organization.entity.OrganizationStatus; import com.dragonguard.backend.domain.organization.entity.OrganizationType; @@ -57,7 +57,8 @@ void decideRequest() throws Exception { 2L, "한국공학대학교", OrganizationType.UNIVERSITY, "tukorea.ac.kr"), new AdminOrganizationResponse( 3L, "Google", OrganizationType.COMPANY, "gmail.com")); - given(adminService.decideRequestedOrganization(any())).willReturn(expected); + given(adminService.decideRequestedOrganization(any())) + .willReturn(new AdminOrganizationResponses(expected)); ResultActions perform = mockMvc.perform( @@ -69,7 +70,7 @@ void decideRequest() throws Exception { 1L, OrganizationStatus.ACCEPTED))) .header("Authorization", "Bearer apfawfawfa.awfsfawef2.r4svfv32")); - perform.andExpect(status().isOk()).andExpect(jsonPath("$").isArray()); + perform.andExpect(status().isOk()); perform.andDo(print()) .andDo( @@ -88,7 +89,8 @@ void getOrganizationsByStatus() throws Exception { 2L, "한국공학대학교", OrganizationType.UNIVERSITY, "tukorea.ac.kr"), new AdminOrganizationResponse( 3L, "Google", OrganizationType.COMPANY, "gmail.com")); - given(adminService.findOrganizationsByStatus(any(), any())).willReturn(expected); + given(adminService.findOrganizationsByStatus(any(), any())) + .willReturn(new AdminOrganizationResponses(expected)); ResultActions perform = mockMvc.perform( @@ -96,7 +98,7 @@ void getOrganizationsByStatus() throws Exception { .contentType(MediaType.APPLICATION_JSON) .header("Authorization", "Bearer apfawfawfa.awfsfawef2.r4svfv32")); - perform.andExpect(status().isOk()).andExpect(jsonPath("$").isArray()); + perform.andExpect(status().isOk()); perform.andDo(print()) .andDo( diff --git a/backend/src/test/java/com/dragonguard/backend/domain/admin/service/AdminServiceTest.java b/backend/src/test/java/com/dragonguard/backend/domain/admin/service/AdminServiceTest.java index c733a93f..f18283ce 100644 --- a/backend/src/test/java/com/dragonguard/backend/domain/admin/service/AdminServiceTest.java +++ b/backend/src/test/java/com/dragonguard/backend/domain/admin/service/AdminServiceTest.java @@ -56,8 +56,10 @@ void getOrganizationsByStatus() { // when List acceptedList = - adminService.findOrganizationsByStatus( - OrganizationStatus.ACCEPTED, PageRequest.of(0, 20)); + adminService + .findOrganizationsByStatus( + OrganizationStatus.ACCEPTED, PageRequest.of(0, 20)) + .getData(); // then assertThat(acceptedList).hasSize(2); diff --git a/backend/src/test/java/com/dragonguard/backend/domain/blockchain/controller/BlockchainControllerTest.java b/backend/src/test/java/com/dragonguard/backend/domain/blockchain/controller/BlockchainControllerTest.java index 8ba0968f..d3b59cd4 100644 --- a/backend/src/test/java/com/dragonguard/backend/domain/blockchain/controller/BlockchainControllerTest.java +++ b/backend/src/test/java/com/dragonguard/backend/domain/blockchain/controller/BlockchainControllerTest.java @@ -7,10 +7,10 @@ import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import com.dragonguard.backend.domain.blockchain.dto.response.BlockchainResponse; +import com.dragonguard.backend.domain.blockchain.dto.response.BlockchainResponses; import com.dragonguard.backend.domain.blockchain.entity.ContributeType; import com.dragonguard.backend.domain.blockchain.service.BlockchainService; import com.dragonguard.backend.domain.blockchain.service.SmartContractService; @@ -54,7 +54,7 @@ void getBlockchainInfo() throws Exception { UUID.randomUUID(), LocalDateTime.now().toString(), "321321321")); - given(blockchainService.getBlockchainList()).willReturn(expected); + given(blockchainService.getBlockchainList()).willReturn(new BlockchainResponses(expected)); ResultActions perform = mockMvc.perform( @@ -62,7 +62,7 @@ void getBlockchainInfo() throws Exception { .contentType(MediaType.APPLICATION_JSON) .header("Authorization", "Bearer apfawfawfa.awfsfawef2.r4svfv32")); - perform.andExpect(status().isOk()).andExpect(jsonPath("$").isArray()); + perform.andExpect(status().isOk()); perform.andDo(print()) .andDo( diff --git a/backend/src/test/java/com/dragonguard/backend/domain/blockchain/service/BlockchainServiceTest.java b/backend/src/test/java/com/dragonguard/backend/domain/blockchain/service/BlockchainServiceTest.java index c9dcb27e..7713e867 100644 --- a/backend/src/test/java/com/dragonguard/backend/domain/blockchain/service/BlockchainServiceTest.java +++ b/backend/src/test/java/com/dragonguard/backend/domain/blockchain/service/BlockchainServiceTest.java @@ -75,7 +75,7 @@ void getBlockchainList() { .collect(Collectors.toList()); // when - List blockchains = blockchainService.getBlockchainList(); + List blockchains = blockchainService.getBlockchainList().getData(); // then assertThat(blockchains).hasSize(3); diff --git a/backend/src/test/java/com/dragonguard/backend/domain/organization/controller/OrganizationControllerTest.java b/backend/src/test/java/com/dragonguard/backend/domain/organization/controller/OrganizationControllerTest.java index 7f3161d4..dd025c1d 100644 --- a/backend/src/test/java/com/dragonguard/backend/domain/organization/controller/OrganizationControllerTest.java +++ b/backend/src/test/java/com/dragonguard/backend/domain/organization/controller/OrganizationControllerTest.java @@ -14,6 +14,7 @@ import com.dragonguard.backend.domain.organization.dto.request.AddMemberRequest; import com.dragonguard.backend.domain.organization.dto.request.OrganizationRequest; import com.dragonguard.backend.domain.organization.dto.response.OrganizationResponse; +import com.dragonguard.backend.domain.organization.dto.response.OrganizationResponses; import com.dragonguard.backend.domain.organization.entity.OrganizationType; import com.dragonguard.backend.domain.organization.service.OrganizationEmailFacade; import com.dragonguard.backend.global.dto.IdResponse; @@ -136,7 +137,8 @@ void getOrganizations() throws Exception { 2L, "서울대학교", OrganizationType.UNIVERSITY, "snu.ac.kr", 10000L), new OrganizationResponse( 3L, "KAIST", OrganizationType.UNIVERSITY, "kaist.ac.kr", 1000L)); - given(organizationService.findByType(any(), any())).willReturn(expected); + given(organizationService.findByType(any(), any())) + .willReturn(new OrganizationResponses(expected)); // when ResultActions perform = @@ -173,7 +175,8 @@ void getOrganizationRank() throws Exception { 2L, "서울대학교", OrganizationType.UNIVERSITY, "snu.ac.kr", 10000L), new OrganizationResponse( 3L, "KAIST", OrganizationType.UNIVERSITY, "kaist.ac.kr", 1000L)); - given(organizationService.getOrganizationRank(any())).willReturn(expected); + given(organizationService.getOrganizationRank(any())) + .willReturn(new OrganizationResponses(expected)); // when ResultActions perform = @@ -210,7 +213,8 @@ void getOrganizationRankByType() throws Exception { 2L, "서울대학교", OrganizationType.UNIVERSITY, "snu.ac.kr", 10000L), new OrganizationResponse( 3L, "KAIST", OrganizationType.UNIVERSITY, "kaist.ac.kr", 1000L)); - given(organizationService.getOrganizationRankByType(any(), any())).willReturn(expected); + given(organizationService.getOrganizationRankByType(any(), any())) + .willReturn(new OrganizationResponses(expected)); // when ResultActions perform = @@ -247,7 +251,8 @@ void searchOrganization() throws Exception { 2L, "서울대학교", OrganizationType.UNIVERSITY, "snu.ac.kr", 10000L), new OrganizationResponse( 3L, "KAIST", OrganizationType.UNIVERSITY, "kaist.ac.kr", 1000L)); - given(organizationService.searchOrganization(any(), any(), any())).willReturn(expected); + given(organizationService.searchOrganization(any(), any(), any())) + .willReturn(new OrganizationResponses(expected)); // when ResultActions perform = diff --git a/backend/src/test/java/com/dragonguard/backend/domain/organization/service/OrganizationServiceTest.java b/backend/src/test/java/com/dragonguard/backend/domain/organization/service/OrganizationServiceTest.java index 85fc3b40..84f80bde 100644 --- a/backend/src/test/java/com/dragonguard/backend/domain/organization/service/OrganizationServiceTest.java +++ b/backend/src/test/java/com/dragonguard/backend/domain/organization/service/OrganizationServiceTest.java @@ -212,11 +212,13 @@ void findByType() { // when List companyResult = - organizationEmailFacade.findByType( - OrganizationType.COMPANY, PageRequest.of(0, 20)); + organizationEmailFacade + .findByType(OrganizationType.COMPANY, PageRequest.of(0, 20)) + .getData(); List universityResult = - organizationEmailFacade.findByType( - OrganizationType.UNIVERSITY, PageRequest.of(0, 20)); + organizationEmailFacade + .findByType(OrganizationType.UNIVERSITY, PageRequest.of(0, 20)) + .getData(); // then assertThat(companyResult).hasSize(1); @@ -230,7 +232,7 @@ void getOrganizationRank() { // when List result = - organizationEmailFacade.getOrganizationRank(PageRequest.of(0, 20)); + organizationEmailFacade.getOrganizationRank(PageRequest.of(0, 20)).getData(); // then assertThat(result).hasSize(1); @@ -243,8 +245,10 @@ void getOrganizationRankByType() { // when List result = - organizationEmailFacade.getOrganizationRankByType( - OrganizationType.UNIVERSITY, PageRequest.of(0, 20)); + organizationEmailFacade + .getOrganizationRankByType( + OrganizationType.UNIVERSITY, PageRequest.of(0, 20)) + .getData(); // then assertThat(result).hasSize(1); @@ -257,8 +261,10 @@ void searchOrganization() { // when List result = - organizationEmailFacade.searchOrganization( - OrganizationType.UNIVERSITY, "한국공학대학교", PageRequest.of(0, 20)); + organizationEmailFacade + .searchOrganization( + OrganizationType.UNIVERSITY, "한국공학대학교", PageRequest.of(0, 20)) + .getData(); // then assertThat(result).hasSize(1); diff --git a/backend/src/test/java/com/dragonguard/backend/domain/search/controller/SearchControllerTest.java b/backend/src/test/java/com/dragonguard/backend/domain/search/controller/SearchControllerTest.java index d9e8c945..8221226a 100644 --- a/backend/src/test/java/com/dragonguard/backend/domain/search/controller/SearchControllerTest.java +++ b/backend/src/test/java/com/dragonguard/backend/domain/search/controller/SearchControllerTest.java @@ -12,7 +12,9 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import com.dragonguard.backend.domain.search.dto.response.GitRepoResultResponse; +import com.dragonguard.backend.domain.search.dto.response.GitRepoResultResponses; import com.dragonguard.backend.domain.search.dto.response.UserResultSearchResponse; +import com.dragonguard.backend.domain.search.dto.response.UserResultSearchResponses; import com.dragonguard.backend.domain.search.service.SearchResultFacade; import com.dragonguard.backend.support.docs.RestDocumentTest; @@ -45,7 +47,8 @@ void getSearchResult() throws Exception { new UserResultSearchResponse(5L, "And", false), new UserResultSearchResponse(6L, "DragonGuard-JinJin", false)); - given(searchService.getUserSearchResultByClient(any(), any())).willReturn(expected); + given(searchService.getUserSearchResultByClient(any(), any())) + .willReturn(new UserResultSearchResponses(expected)); // when ResultActions perform = @@ -100,7 +103,7 @@ void getSearchResultByFiltering() throws Exception { LocalDateTime.now().toString())); given(searchService.getGitRepoSearchResultByClient(any(), any(), any())) - .willReturn(expected); + .willReturn(new GitRepoResultResponses(expected)); // when ResultActions perform = @@ -110,7 +113,7 @@ void getSearchResultByFiltering() throws Exception { .header("Authorization", "Bearer apfawfawfa.awfsfawef2.r4svfv32")); // then - perform.andExpect(status().isOk()).andExpect(jsonPath("$").isArray()); + perform.andExpect(status().isOk()); // docs perform.andDo(print())