From 2cdcc7d6104b8f5bfd7e7f76c44749edaf838647 Mon Sep 17 00:00:00 2001 From: chaeyoungeee Date: Sun, 28 Jul 2024 17:13:26 +0900 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20=EB=82=98=EC=9D=98=20=EA=B4=80?= =?UTF-8?q?=EC=8B=AC=20=EB=AC=B8=ED=99=94=20=EC=A1=B0=ED=9A=8C=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 페이징을 포함한 나의 관심 문화 조회 기능을 추가함 --- .../api/culture/CultureController.java | 13 ++++++++++- .../MZConnent/config/SecurityConfig.java | 23 ++++++++++++++----- .../repository/culture/CultureRepository.java | 3 +++ .../service/culture/CultureService.java | 18 +++++++++++++++ 4 files changed, 50 insertions(+), 7 deletions(-) diff --git a/src/main/java/likelion/MZConnent/api/culture/CultureController.java b/src/main/java/likelion/MZConnent/api/culture/CultureController.java index ce5a3c7..76e9e4b 100644 --- a/src/main/java/likelion/MZConnent/api/culture/CultureController.java +++ b/src/main/java/likelion/MZConnent/api/culture/CultureController.java @@ -4,11 +4,13 @@ import likelion.MZConnent.dto.culture.response.CulturesSimpleResponse; import likelion.MZConnent.dto.paging.response.PageContentResponse; import likelion.MZConnent.dto.review.response.ReviewsSimpleResponse; +import likelion.MZConnent.jwt.principle.UserPrinciple; import likelion.MZConnent.service.culture.CultureCategoryService; import likelion.MZConnent.service.culture.CultureService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.http.ResponseEntity; +import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @@ -31,9 +33,18 @@ public ResponseEntity getAllCultureCategories() { // 전체 문화 간단 조회 @GetMapping("/api/cultures") - ResponseEntity getReviewSimpleList(@RequestParam(required = false, defaultValue = "0", value = "category") Long category, @RequestParam(required = false, defaultValue = "0", value = "page") int page ) { + ResponseEntity getCulturesSimpleList(@RequestParam(required = false, defaultValue = "0", value = "category") Long category, @RequestParam(required = false, defaultValue = "0", value = "page") int page ) { PageContentResponse response = cultureService.getCulturesSimpleList(category, page); return ResponseEntity.ok(response); } + + + // 나의 관심 문화 간단 조회 + @GetMapping("/api/cultures/interest") + ResponseEntity getMyInterestCulturesSimpleList(@RequestParam(required = false, defaultValue = "0", value = "category") Long category, @RequestParam(required = false, defaultValue = "0", value = "page") int page, @AuthenticationPrincipal UserPrinciple userPrinciple) { + + PageContentResponse response = cultureService.getMyIntersetCulturesSimpleList(userPrinciple.getEmail(), category, page); + return ResponseEntity.ok(response); + } } diff --git a/src/main/java/likelion/MZConnent/config/SecurityConfig.java b/src/main/java/likelion/MZConnent/config/SecurityConfig.java index 7550702..0aba1ad 100644 --- a/src/main/java/likelion/MZConnent/config/SecurityConfig.java +++ b/src/main/java/likelion/MZConnent/config/SecurityConfig.java @@ -1,6 +1,5 @@ package likelion.MZConnent.config; -import jakarta.servlet.http.HttpServletRequest; import likelion.MZConnent.jwt.JwtAccessDeniedHandler; import likelion.MZConnent.jwt.JwtAuthenticationEntryPoint; import likelion.MZConnent.jwt.JwtFilter; @@ -31,19 +30,30 @@ public class SecurityConfig { private final JwtAccessDeniedHandler jwtAccessDeniedHandler; private final JwtFilter jwtFilter; - //권한별 url + /** + * 권한별 URI + */ + + // 관리자 권한 private final String[] adminUrl = {"/admin/**"}; - // 아무나 접속 가능한 것 + + // 인증된 사용자만 접근 가능한 URI (permitAllUrl과 겹치는 경우에만 추가 -> 미인증 사용자가 접근하는 URI는 모두 인가가 필요하게 설정되어 있어 추가할 필요 없음) + private final String[] authenticatedUrl = { + "/api/cultures/interest" + }; + + // 아무나 접근 가능한 URI private final String[] permitAllUrl = {"/error", "/api/auth/login", // 회원 - "/api/categories/culture", "/api/cultures", "/api/cultures/*", // 문화 + "/api/categories/culture", "/api/cultures", "/api/cultures/**", // 문화 "/api/reviews", // 후기 "/api/categories/region", "/api/clubs/list", "/api/main", "/swagger", "/swagger-ui.html", "/swagger-ui/**", "/api-docs", "/api-docs/**", "/v3/api-docs/**", //swagger "/api/test" }; - // 로그인 안한 사용자만 접속 가능한 것 + + // 인증되지 않은 사용자만 접근 가능한 URI private final String[] anonymousUrl = { "/api/auth/signup" }; @@ -63,8 +73,9 @@ public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws .accessDeniedHandler(jwtAccessDeniedHandler) ) .addFilterBefore(jwtFilter, UsernamePasswordAuthenticationFilter.class) - .authorizeHttpRequests(auth -> auth // 접근 url 권한 관리 + .authorizeHttpRequests(auth -> auth // 접근 uri 권한 관리 .requestMatchers(adminUrl).hasAnyRole("ADMIN") + .requestMatchers(authenticatedUrl).authenticated() .requestMatchers(permitAllUrl).permitAll() .requestMatchers(anonymousUrl).anonymous() .anyRequest().authenticated() // 이 외의 url은 인증받은 사용자만 접근 가능 diff --git a/src/main/java/likelion/MZConnent/repository/culture/CultureRepository.java b/src/main/java/likelion/MZConnent/repository/culture/CultureRepository.java index f5e044b..66fb886 100644 --- a/src/main/java/likelion/MZConnent/repository/culture/CultureRepository.java +++ b/src/main/java/likelion/MZConnent/repository/culture/CultureRepository.java @@ -12,4 +12,7 @@ public interface CultureRepository extends JpaRepository { @Query("SELECT c FROM Culture c WHERE :category = 0 OR c.cultureCategory.id = :category") Page findAllByCultureCategory(@Param("category") Long category, Pageable pageable); + + @Query("SELECT c FROM Culture c JOIN c.cultureInterests ci JOIN ci.member m WHERE (:category = 0 OR c.cultureCategory.id = :category) AND m.email = :email") + Page findByMemberAndCategory(@Param("email") String email, @Param("category") Long category, Pageable pageable); } diff --git a/src/main/java/likelion/MZConnent/service/culture/CultureService.java b/src/main/java/likelion/MZConnent/service/culture/CultureService.java index d390555..63221ff 100644 --- a/src/main/java/likelion/MZConnent/service/culture/CultureService.java +++ b/src/main/java/likelion/MZConnent/service/culture/CultureService.java @@ -42,4 +42,22 @@ public PageContentResponse getCulturesSimpleList(Long cu .build(); } + + public PageContentResponse getMyIntersetCulturesSimpleList(String email, Long cultureCategoryId, int page) { + Pageable pageable = PageRequest.of(page, PAGE_SIZE); + + Page cultures = cultureRepository.findByMemberAndCategory(email, cultureCategoryId, pageable); + + List cultureResponse = cultures.stream().map(culture -> CulturesSimpleResponse.builder() + .culture(culture).build() + ).collect(Collectors.toList()); + + return PageContentResponse.builder() + .content(cultureResponse) + .totalPages(cultures.getTotalPages()) + .totalElements(cultures.getTotalElements()) + .size(pageable.getPageSize()) + .build(); + + } } From f98e1b74bbb53c42794610851a1d9c805af59829 Mon Sep 17 00:00:00 2001 From: chaeyoungeee Date: Sun, 28 Jul 2024 18:52:18 +0900 Subject: [PATCH 2/5] =?UTF-8?q?feat:=20=EB=AC=B8=ED=99=94=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20=EC=A0=95=EB=B3=B4=20=EC=A1=B0=ED=9A=8C=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문화 상세 정보 조회 기능 추가함 --- .../api/culture/CultureController.java | 15 +++- .../MZConnent/domain/club/ClubRole.java | 4 + .../response/CultureDetailResponse.java | 90 +++++++++++++++++++ .../response/ReviewsSimpleResponse.java | 1 + .../service/culture/CultureService.java | 12 +++ 5 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 src/main/java/likelion/MZConnent/dto/culture/response/CultureDetailResponse.java diff --git a/src/main/java/likelion/MZConnent/api/culture/CultureController.java b/src/main/java/likelion/MZConnent/api/culture/CultureController.java index 76e9e4b..50e0bc3 100644 --- a/src/main/java/likelion/MZConnent/api/culture/CultureController.java +++ b/src/main/java/likelion/MZConnent/api/culture/CultureController.java @@ -1,6 +1,7 @@ package likelion.MZConnent.api.culture; import likelion.MZConnent.dto.culture.response.CultureCategoryResponse; +import likelion.MZConnent.dto.culture.response.CultureDetailResponse; import likelion.MZConnent.dto.culture.response.CulturesSimpleResponse; import likelion.MZConnent.dto.paging.response.PageContentResponse; import likelion.MZConnent.dto.review.response.ReviewsSimpleResponse; @@ -12,6 +13,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @@ -33,7 +35,7 @@ public ResponseEntity getAllCultureCategories() { // 전체 문화 간단 조회 @GetMapping("/api/cultures") - ResponseEntity getCulturesSimpleList(@RequestParam(required = false, defaultValue = "0", value = "category") Long category, @RequestParam(required = false, defaultValue = "0", value = "page") int page ) { + public ResponseEntity getCulturesSimpleList(@RequestParam(required = false, defaultValue = "0", value = "category") Long category, @RequestParam(required = false, defaultValue = "0", value = "page") int page) { PageContentResponse response = cultureService.getCulturesSimpleList(category, page); return ResponseEntity.ok(response); @@ -42,9 +44,18 @@ ResponseEntity getCulturesSimpleList(@RequestParam(required // 나의 관심 문화 간단 조회 @GetMapping("/api/cultures/interest") - ResponseEntity getMyInterestCulturesSimpleList(@RequestParam(required = false, defaultValue = "0", value = "category") Long category, @RequestParam(required = false, defaultValue = "0", value = "page") int page, @AuthenticationPrincipal UserPrinciple userPrinciple) { + public ResponseEntity getMyInterestCulturesSimpleList(@RequestParam(required = false, defaultValue = "0", value = "category") Long category, @RequestParam(required = false, defaultValue = "0", value = "page") int page, @AuthenticationPrincipal UserPrinciple userPrinciple) { PageContentResponse response = cultureService.getMyIntersetCulturesSimpleList(userPrinciple.getEmail(), category, page); return ResponseEntity.ok(response); } + + @GetMapping("/api/cultures/{cultureId}") + public ResponseEntity getCultureDetailInfo(@PathVariable("cultureId") Long cultureId) { + CultureDetailResponse response = cultureService.getCultureDetailInfo(cultureId); + + log.info("문화 정보 조회 성공: {}", response.getCultureId()); + + return ResponseEntity.ok(response); + } } diff --git a/src/main/java/likelion/MZConnent/domain/club/ClubRole.java b/src/main/java/likelion/MZConnent/domain/club/ClubRole.java index 586b01c..15aecc4 100644 --- a/src/main/java/likelion/MZConnent/domain/club/ClubRole.java +++ b/src/main/java/likelion/MZConnent/domain/club/ClubRole.java @@ -1,5 +1,7 @@ package likelion.MZConnent.domain.club; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -11,10 +13,12 @@ public enum ClubRole { private final String clubRole; + @JsonValue public String getClubRole() { return clubRole; } + @JsonProperty public static ClubRole fromRole(String role) { for (ClubRole cR : ClubRole.values()) { if (cR.getClubRole().equals(role)) { diff --git a/src/main/java/likelion/MZConnent/dto/culture/response/CultureDetailResponse.java b/src/main/java/likelion/MZConnent/dto/culture/response/CultureDetailResponse.java new file mode 100644 index 0000000..ebbb7d8 --- /dev/null +++ b/src/main/java/likelion/MZConnent/dto/culture/response/CultureDetailResponse.java @@ -0,0 +1,90 @@ +package likelion.MZConnent.dto.culture.response; + +import likelion.MZConnent.domain.club.AgeRestriction; +import likelion.MZConnent.domain.club.Club; +import likelion.MZConnent.domain.club.ClubRole; +import likelion.MZConnent.domain.club.GenderRestriction; +import likelion.MZConnent.domain.culture.Culture; +import likelion.MZConnent.dto.review.response.ReviewsSimpleResponse; +import lombok.*; +import lombok.extern.slf4j.Slf4j; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +@Getter +@Slf4j +@ToString +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class CultureDetailResponse { + private Long cultureId; + private String name; + private String cultureImageUrl; + private String regionName; + private int interestCount; + private String recommendedMember; + private String content; + private List clubs; + private List reviews; + + @Builder + public CultureDetailResponse(Culture culture) { + this.cultureId = culture.getCultureId(); + this.name = culture.getName(); + this.cultureImageUrl = culture.getCultureImageUrl(); + this.regionName = culture.getRegion().getName(); + this.interestCount = culture.getInterestCount(); + this.recommendedMember = culture.getRecommendedMember(); + this.content = culture.getContent(); + this.clubs = culture.getClubs().stream().filter(club -> + (club.getStatus().equals("OPEN") + )).map(club -> + ClubsSimpleResponse.builder() + .club(club).build()).collect(Collectors.toList()); + this.reviews = culture.getReviews().stream().map( + review -> ReviewsSimpleResponse.builder() + .review(review).build() + ).collect(Collectors.toList()); + } + + + @Getter + @ToString + @NoArgsConstructor(access = AccessLevel.PROTECTED) + static private class ClubsSimpleResponse { + private Long clubId; + private String title; + private String regionName; + private String cultureName; + private String leaderProfileImage; + private LocalDate meetingDate; + private LocalDateTime createdDate; + private GenderRestriction genderRestriction; + private AgeRestriction ageRestriction; + private int currentParticipant; + private int maxParticipant; + + @Builder + public ClubsSimpleResponse(Club club) { + this.clubId = club.getClubId(); + this.title = club.getTitle(); + this.regionName = club.getRegion().getName(); + this.cultureName = club.getCulture().getName(); + this.leaderProfileImage = club.getClubMembers().stream().filter((member) -> + member.getClubRole() == ClubRole.LEADER + ).findFirst().orElseThrow(() -> { + log.info("모임장이 존재하지 않음."); + return new IllegalArgumentException("모임장이 존재하지 않습니다."); + }).getMember().getProfileImageUrl(); + this.meetingDate = club.getMeetingDate(); + this.createdDate = club.getCreatedDate(); + this.genderRestriction = club.getGenderRestriction(); + this.ageRestriction = club.getAgeRestriction(); + this.currentParticipant = club.getCurrentParticipant(); + this.maxParticipant = club.getMaxParticipant(); + } + } +} diff --git a/src/main/java/likelion/MZConnent/dto/review/response/ReviewsSimpleResponse.java b/src/main/java/likelion/MZConnent/dto/review/response/ReviewsSimpleResponse.java index d738635..515c034 100644 --- a/src/main/java/likelion/MZConnent/dto/review/response/ReviewsSimpleResponse.java +++ b/src/main/java/likelion/MZConnent/dto/review/response/ReviewsSimpleResponse.java @@ -9,6 +9,7 @@ @Getter @NoArgsConstructor +@ToString public class ReviewsSimpleResponse { private Long reviewId; private MemberProfileDto reviewer; diff --git a/src/main/java/likelion/MZConnent/service/culture/CultureService.java b/src/main/java/likelion/MZConnent/service/culture/CultureService.java index 63221ff..8a62dd7 100644 --- a/src/main/java/likelion/MZConnent/service/culture/CultureService.java +++ b/src/main/java/likelion/MZConnent/service/culture/CultureService.java @@ -2,6 +2,7 @@ import likelion.MZConnent.domain.culture.Culture; import likelion.MZConnent.domain.review.Review; +import likelion.MZConnent.dto.culture.response.CultureDetailResponse; import likelion.MZConnent.dto.culture.response.CulturesSimpleResponse; import likelion.MZConnent.dto.paging.response.PageContentResponse; import likelion.MZConnent.dto.review.response.ReviewsSimpleResponse; @@ -14,12 +15,14 @@ import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.stream.Collectors; @Service @Slf4j +@Transactional @RequiredArgsConstructor public class CultureService { private final CultureRepository cultureRepository; @@ -60,4 +63,13 @@ public PageContentResponse getMyIntersetCulturesSimpleLi .build(); } + + public CultureDetailResponse getCultureDetailInfo(Long cultureId) { + Culture culture = cultureRepository.findById(cultureId).orElseThrow(() -> { + log.info("해당 문화가 존재하지 않습니다."); + return new IllegalArgumentException("해당 문화가 존재하지 않습니다."); + }); + return CultureDetailResponse.builder() + .culture(culture).build(); + } } From 94c1e0234f7e6d9d2a34c074dbe17e9d4df050cf Mon Sep 17 00:00:00 2001 From: chaeyoungeee Date: Sun, 28 Jul 2024 18:53:10 +0900 Subject: [PATCH 3/5] =?UTF-8?q?test:=20=EB=AC=B8=ED=99=94=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20=EC=A0=95=EB=B3=B4=20=EC=A1=B0=ED=9A=8C=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../culture/CultureCategoryServiceTest.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/test/java/likelion/MZConnent/service/culture/CultureCategoryServiceTest.java diff --git a/src/test/java/likelion/MZConnent/service/culture/CultureCategoryServiceTest.java b/src/test/java/likelion/MZConnent/service/culture/CultureCategoryServiceTest.java new file mode 100644 index 0000000..d0b1444 --- /dev/null +++ b/src/test/java/likelion/MZConnent/service/culture/CultureCategoryServiceTest.java @@ -0,0 +1,47 @@ +package likelion.MZConnent.service.culture; + +import likelion.MZConnent.dto.culture.response.CultureCategoryResponse; +import likelion.MZConnent.dto.culture.response.CultureDetailResponse; +import likelion.MZConnent.repository.member.MemberRepository; +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +@Slf4j +@SpringBootTest +class CultureCategoryServiceTest { + @Autowired + CultureCategoryService cultureCategoryService; + + @Autowired + MemberRepository memberRepository; + + @Autowired + CultureService cultureService; + + @Test + public void getCultureCategory() throws Exception { + //given + + //when + CultureCategoryResponse all = cultureCategoryService.getAllCultureCategories(); + + //then + Assertions.assertEquals(all.getCultureCategories().size(), 5); + } + + @Test + public void getCultureDetailInfo() throws Exception { + //given + Long cultureId = 1L; + + //when + CultureDetailResponse cultureDetailInfo = cultureService.getCultureDetailInfo(cultureId); + + //then + log.info("문화: {}", cultureDetailInfo); + Assertions.assertEquals(cultureDetailInfo.getCultureId(), 1L); + } +} \ No newline at end of file From b006fa9d2656a9762be26e7bc1c138075bfe3f63 Mon Sep 17 00:00:00 2001 From: chaeyoungeee Date: Sun, 28 Jul 2024 18:56:43 +0900 Subject: [PATCH 4/5] =?UTF-8?q?test:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MZConnent/service/culture/CultureCategoryServiceTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/likelion/MZConnent/service/culture/CultureCategoryServiceTest.java b/src/test/java/likelion/MZConnent/service/culture/CultureCategoryServiceTest.java index d0b1444..eff2de7 100644 --- a/src/test/java/likelion/MZConnent/service/culture/CultureCategoryServiceTest.java +++ b/src/test/java/likelion/MZConnent/service/culture/CultureCategoryServiceTest.java @@ -29,7 +29,7 @@ public void getCultureCategory() throws Exception { CultureCategoryResponse all = cultureCategoryService.getAllCultureCategories(); //then - Assertions.assertEquals(all.getCultureCategories().size(), 5); +// Assertions.assertEquals(all.getCultureCategories().size(), 5); } @Test From ea9cac42f97c3a0bc54072ceae113090e3ad0720 Mon Sep 17 00:00:00 2001 From: chaeyoungeee Date: Sun, 28 Jul 2024 18:59:14 +0900 Subject: [PATCH 5/5] =?UTF-8?q?test:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../culture/CultureCategoryServiceTest.java | 47 ------------------- 1 file changed, 47 deletions(-) delete mode 100644 src/test/java/likelion/MZConnent/service/culture/CultureCategoryServiceTest.java diff --git a/src/test/java/likelion/MZConnent/service/culture/CultureCategoryServiceTest.java b/src/test/java/likelion/MZConnent/service/culture/CultureCategoryServiceTest.java deleted file mode 100644 index eff2de7..0000000 --- a/src/test/java/likelion/MZConnent/service/culture/CultureCategoryServiceTest.java +++ /dev/null @@ -1,47 +0,0 @@ -package likelion.MZConnent.service.culture; - -import likelion.MZConnent.dto.culture.response.CultureCategoryResponse; -import likelion.MZConnent.dto.culture.response.CultureDetailResponse; -import likelion.MZConnent.repository.member.MemberRepository; -import lombok.extern.slf4j.Slf4j; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; - -@Slf4j -@SpringBootTest -class CultureCategoryServiceTest { - @Autowired - CultureCategoryService cultureCategoryService; - - @Autowired - MemberRepository memberRepository; - - @Autowired - CultureService cultureService; - - @Test - public void getCultureCategory() throws Exception { - //given - - //when - CultureCategoryResponse all = cultureCategoryService.getAllCultureCategories(); - - //then -// Assertions.assertEquals(all.getCultureCategories().size(), 5); - } - - @Test - public void getCultureDetailInfo() throws Exception { - //given - Long cultureId = 1L; - - //when - CultureDetailResponse cultureDetailInfo = cultureService.getCultureDetailInfo(cultureId); - - //then - log.info("문화: {}", cultureDetailInfo); - Assertions.assertEquals(cultureDetailInfo.getCultureId(), 1L); - } -} \ No newline at end of file