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

[Develop] 10주차 PR #133

Merged
merged 138 commits into from
Nov 8, 2024
Merged
Changes from 1 commit
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
9f531bb
[feat] 로그인 성공 시, frontend 주소로 redirect
suhyeon7497 Oct 30, 2024
51c3f4b
[refactor] 로그인 query문 2개 -> 1개
suhyeon7497 Oct 30, 2024
099b6ed
[feat] Kakao Location Message만들기
suhyeon7497 Oct 31, 2024
87e2dd1
Merge branch 'feat/#7-place' into feat/#87-liked-place
dong-yxxn Oct 31, 2024
e2aca49
[chore] webClientConfig 추가
suhyeon7497 Oct 31, 2024
1ec8a44
[chore] kakaoMessageToMeUrl 추가
suhyeon7497 Oct 31, 2024
be0f1ac
[fix] WebClientConfig에 @Configuration 추가
suhyeon7497 Oct 31, 2024
e184d81
[feat]: LikedPlace Entity와 Repository를 생성했어요!
dong-yxxn Oct 31, 2024
d5cc620
[feat] 장소 좋아요 기능 구현
dong-yxxn Nov 1, 2024
85ff328
[chore] import문 최적화
Nov 2, 2024
fd2dd1f
[refactor] html 파일이 모두 모달을 사용하게 되어서 css 파일 통합
Nov 2, 2024
05920f8
[refactor] css 파일 통합에 따른 수정
Nov 2, 2024
e17f24b
[feat] 장소 정보 검색 기능 구현
Nov 2, 2024
1b93cb2
[refactor] makeCookie Static
suhyeon7497 Nov 2, 2024
3427a70
[feat] 현재 로그인 되어있지 않은 유저 확인
suhyeon7497 Nov 2, 2024
40be572
Revert "[refactor] html 파일이 모두 모달을 사용하게 되어서 css 파일 통합"
Nov 4, 2024
7dc6d87
[refactor] 모달을 쓰는 두 페이지의 공통 css와 에러 관련 css를 분리
Nov 4, 2024
22afabb
[feat] 리뷰 반환에 본인 여부 추가
wndlthsk Nov 4, 2024
56b2fe6
[test] 리뷰 반환 테스트 추가
wndlthsk Nov 4, 2024
8eb7459
[feat] 리뷰 삭제 기능
wndlthsk Nov 4, 2024
e1c27a3
[test] 리뷰 삭제 테스트 추가
wndlthsk Nov 4, 2024
39838e8
[refactor] 원시값 제거
suhyeon7497 Nov 4, 2024
d8b553d
[feat] 로그인 시 oauthToken 저장
suhyeon7497 Nov 4, 2024
387dc9b
Merge branch 'weekly/10' of https://github.com/kakao-tech-campus-2nd-…
suhyeon7497 Nov 4, 2024
e3ceb91
[chore] 누락정보 추가
suhyeon7497 Nov 4, 2024
a18717e
[chore] 오타 수정
suhyeon7497 Nov 4, 2024
d973333
Merge pull request #100 from kakao-tech-campus-2nd-step3/feat/#99-Vid…
sanghee0820 Nov 4, 2024
3b137bf
[feat] PlaceInfo와 PlaceDetailInfo에 좋아요 여부를 반영했어요
dong-yxxn Nov 5, 2024
f64eca1
[refactor] place정보를 크롤링 해 오는 매서드 이름 변경
sanghee0820 Nov 5, 2024
bc8d191
[refactor] 장소 정보와 위치 정보 반환 매서드 이름 변경
sanghee0820 Nov 5, 2024
2fc1b43
[feat] 장소 관련 에러 코드 추가
sanghee0820 Nov 5, 2024
7dc1a35
[refactor] 이너클래스로 DTO 변경
sanghee0820 Nov 5, 2024
1dcb79b
[feat] placeId로 장소 정보 찾기 기능 추가
sanghee0820 Nov 5, 2024
0a9e71f
[feat] video에 place 업데이트 기능 추가
sanghee0820 Nov 5, 2024
307ec32
[feat] placeId로 크롤링 해 저장하는 기능 추가
sanghee0820 Nov 5, 2024
067ad06
[chore] 에러 메세지를 영어에서 한글로 변경
suhyeon7497 Nov 5, 2024
b0a0241
[feat] OauthToken DB 저장할때 암호화
suhyeon7497 Nov 5, 2024
aba24d2
conflict merge
dong-yxxn Nov 6, 2024
294ac26
[feat] Cool 한 그곳을 반환하는 로직 및 api 작성
Nov 6, 2024
13ec079
Merge remote-tracking branch 'origin/weekly/10' into feat/#87-liked-p…
dong-yxxn Nov 6, 2024
fc74828
[chore] description 수정
Nov 6, 2024
7d409fb
Merge remote-tracking branch 'origin/Master' into feat/#103-VideoCool…
Nov 6, 2024
7dbd5f1
[build] 중복 빌드문 삭제
Nov 6, 2024
9f1936e
Merge pull request #102 from kakao-tech-campus-2nd-step3/feat/#50-pla…
sanghee0820 Nov 6, 2024
8e06474
[feat] 서버 사이드 렌더링으로 변경
sanghee0820 Nov 6, 2024
e0b032e
[fix] " "로 기본값을 설정해 파싱 시 인덱스 오류 수정
sanghee0820 Nov 6, 2024
7a0cb0e
[feat] 서버 사이드 렌더링 어트리뷰트 추가
sanghee0820 Nov 6, 2024
b416644
[feat] Video에 장소 정보 등록 API 추가
sanghee0820 Nov 6, 2024
8f87ca4
[feat] 페이지네이션 추가
sanghee0820 Nov 6, 2024
10770ec
[fix] 기본 값을 공백을 포함한 문자열로 추가
sanghee0820 Nov 6, 2024
b6a5c42
[fix] 비디오 조회수 첫 등록 시, increase 수치를 viewcount와 동일하게 설정
Nov 6, 2024
1c6246a
[feat] placeMessage를 위한 LinkTemplate정의
suhyeon7497 Nov 6, 2024
6db5526
[feat] placeMessage를 보내는 기능 작성
suhyeon7497 Nov 6, 2024
f02bbdc
[test] video 도메인의 repository 클래스 유닛 테스트 구현
Nov 6, 2024
9c3b62c
[feat] placeMessage를 보내는 controller를 작성하였습니다.
suhyeon7497 Nov 6, 2024
822d75c
[feat] Test 과정에서 Id 삽입을 위한 Util 클래스 구현
Nov 6, 2024
bc6bf23
[test] video 도메인의 service 클래스 유닛 테스트 구현
Nov 6, 2024
32fa73a
[refactor] 내 주변 장소의 비디오를 찾을 때, 경계값 정보를 고정적으로 사용 ( 인자로 받지 않음 )
Nov 6, 2024
d6bab19
[refactor] 기본 값 설정 및 범위 조건 변경
Nov 6, 2024
e4c952c
[refactor] 불필요한 public 접근제한자 제거
dong-yxxn Nov 6, 2024
ca55b4c
[refactor]: likedPlace save 메서드 위치변경으로 응집성 향상
dong-yxxn Nov 6, 2024
f579164
[refactor]: error코드 메시지를 한글로 변경함
dong-yxxn Nov 6, 2024
a7696fb
Merge pull request #107 from kakao-tech-campus-2nd-step3/feat/#101-cr…
sanghee0820 Nov 6, 2024
01d1f79
[refactor] placeMessageCommand에서 uuid를 바로 사용하도록 하였습니다.
suhyeon7497 Nov 6, 2024
4da980d
Merge branch 'weekly/10' of https://github.com/kakao-tech-campus-2nd-…
suhyeon7497 Nov 6, 2024
9add6fd
[fix] .env파일을 삭제하고 다시 만들도록 변경
sanghee0820 Nov 6, 2024
cde55a1
Merge pull request #112 from kakao-tech-campus-2nd-step3/feat/#111-de…
sanghee0820 Nov 6, 2024
c9b59a1
[fix] cat문 삭제
sanghee0820 Nov 6, 2024
a141b37
Merge pull request #113 from kakao-tech-campus-2nd-step3/feat/#111-de…
sanghee0820 Nov 6, 2024
812c192
[refactor]: userId 사용으로 db 접근 최소화
dong-yxxn Nov 6, 2024
6a7d7af
Merge branch 'weekly/10' into feat/#87-liked-place
dong-yxxn Nov 6, 2024
8716aca
[fix] 충돌 및 오타해결
dong-yxxn Nov 6, 2024
e104cda
[feat] 무중단 배포
wndlthsk Nov 6, 2024
41ef6be
Merge pull request #114 from kakao-tech-campus-2nd-step3/feat/#108-bl…
wndlthsk Nov 6, 2024
82927b6
[schema] place관련 DDL에 cascade 추가
sanghee0820 Nov 7, 2024
f1dbff2
[schema] 새로 추가된 엔티티 DDL추가
sanghee0820 Nov 7, 2024
126ae20
[chore] 리뷰 패키지 추가
wndlthsk Nov 7, 2024
26af073
[refactor] ChannelUUID를 통해 비디오 채널을 찾도록 수정
sanghee0820 Nov 7, 2024
2f5cb70
[refactor] videoCommand가 null일 경우 처리 추가
sanghee0820 Nov 7, 2024
006383d
Merge remote-tracking branch 'origin/weekly/10' into feat/#87-liked-p…
dong-yxxn Nov 7, 2024
ce89ffe
[fix] 리뷰 에러코드 수정
wndlthsk Nov 7, 2024
e8c843c
[refactor] 패키지 이동으로 인한 변경
wndlthsk Nov 7, 2024
044afa1
[feat] 여러 인플루언서 좋아요 로직 추가
wndlthsk Nov 7, 2024
bf9f66a
[chore] 충돌해결
wndlthsk Nov 7, 2024
f0f0e2a
[fix] 오타 수정
wndlthsk Nov 7, 2024
b7a77cc
[feat] 비디오 삭제버튼 추가
sanghee0820 Nov 7, 2024
d42bc2a
[feat] 비디오 삭제 기능 추가
sanghee0820 Nov 7, 2024
649daf6
Merge pull request #106 from kakao-tech-campus-2nd-step3/feat/#87-lik…
sanghee0820 Nov 7, 2024
4eb0074
[feat] 특정 시간 뒤 작동하는 기능
suhyeon7497 Nov 7, 2024
a1d7262
[refactor]: Place faliclity가 빈문자열일때, 빈 json 반환하도록 수정
dong-yxxn Nov 7, 2024
0549234
Merge branch 'weekly/10' into feat/#50-placeMessage
dong-yxxn Nov 7, 2024
2114ab0
[feat] 3일 뒤 review message를 보내는 기능
suhyeon7497 Nov 7, 2024
64c238c
Merge pull request #117 from kakao-tech-campus-2nd-step3/feat/#87-lik…
sanghee0820 Nov 7, 2024
3f61de9
[fix] 404 및 500 에러 해결
Nov 7, 2024
0e03c0a
Merge pull request #116 from kakao-tech-campus-2nd-step3/feat/#75-pla…
sanghee0820 Nov 7, 2024
aac5563
Merge remote-tracking branch 'origin/weekly/10' into refactor/VideoUs…
Nov 7, 2024
48c85b7
Merge branch 'weekly/10' of https://github.com/kakao-tech-campus-2nd-…
suhyeon7497 Nov 7, 2024
8162657
[chore] 주석 삭제
Nov 7, 2024
6d87f09
[refactor] 유저 로그인 체크 방식 변경
Nov 7, 2024
859be3d
Merge branch 'feat/#50-placeMessage' of https://github.com/kakao-tech…
suhyeon7497 Nov 7, 2024
a182dcd
Merge pull request #110 from kakao-tech-campus-2nd-step3/feat/#103-Vi…
BaeJunH0 Nov 7, 2024
96ef99b
Merge pull request #109 from kakao-tech-campus-2nd-step3/feat/#50-pla…
sanghee0820 Nov 7, 2024
7997b4a
[chore] console에 log 남는 거 삭제
suhyeon7497 Nov 7, 2024
f702ff8
[refactor]: facility Json 변경
dong-yxxn Nov 7, 2024
e0b1c03
Merge remote-tracking branch 'origin/weekly/10' into feat/#87-liked-p…
dong-yxxn Nov 7, 2024
7a0dac2
Merge pull request #120 from kakao-tech-campus-2nd-step3/feat/#87-lik…
sanghee0820 Nov 7, 2024
e5ba0a7
[feat] 유저 닉네임 변경 기능 구현
Nov 7, 2024
ab39417
Merge pull request #119 from kakao-tech-campus-2nd-step3/feat/#50-pla…
sanghee0820 Nov 7, 2024
8fcde86
[refactor] 위도 및 경도 기본 값과 계산 매개변수 변경
Nov 7, 2024
6339b93
[fix] 컨테이너 이름 오류
wndlthsk Nov 7, 2024
db953a6
Merge pull request #123 from kakao-tech-campus-2nd-step3/feat/#108-bl…
wndlthsk Nov 7, 2024
0a7fefd
Merge remote-tracking branch 'origin/weekly/10' into refactor/VideoUs…
Nov 7, 2024
b3dcb97
Merge pull request #121 from kakao-tech-campus-2nd-step3/feat/#104-ni…
sanghee0820 Nov 7, 2024
87eeecd
Merge pull request #118 from kakao-tech-campus-2nd-step3/refactor/Vid…
sanghee0820 Nov 7, 2024
ebdb234
[fix] 이전 컨테이너 삭제
wndlthsk Nov 7, 2024
9acac2b
Merge pull request #124 from kakao-tech-campus-2nd-step3/feat/#108-bl…
wndlthsk Nov 7, 2024
d8d4179
[fix] 현재버전 환경변수 사용으로 수정
wndlthsk Nov 7, 2024
9f91bbb
Merge pull request #125 from kakao-tech-campus-2nd-step3/feat/#108-bl…
wndlthsk Nov 7, 2024
bb10199
[fix] 대문자 오류를 소문자로 변경
wndlthsk Nov 7, 2024
878c9ff
Merge pull request #126 from kakao-tech-campus-2nd-step3/feat/#108-bl…
wndlthsk Nov 7, 2024
d83b167
[refactor] 코드 간결화
wndlthsk Nov 8, 2024
635ce37
[refactor] isNotLoginUser() 사용으로 변경
wndlthsk Nov 8, 2024
df72cda
[hotfix]: liked_place table 생성
dong-yxxn Nov 8, 2024
d88d8c9
Merge remote-tracking branch 'origin/weekly/10' into feat/#87-liked-p…
dong-yxxn Nov 8, 2024
50b48be
[refactor]: 패키지명 LikedPlace -> likedPlace로 변경함
dong-yxxn Nov 8, 2024
3720294
[refactor]: liked_places 테이블 생성 DDL 추가
dong-yxxn Nov 8, 2024
b91dc35
[refactor]: PlacesResponse를 Page형식으로 변경
dong-yxxn Nov 8, 2024
d5f76d4
[refactor] 인플루언서 반환 페이지네이션 적용
wndlthsk Nov 8, 2024
31f3070
[refactor] 테스트 수정
wndlthsk Nov 8, 2024
d6d096f
Merge pull request #129 from kakao-tech-campus-2nd-step3/feat/#87-lik…
sanghee0820 Nov 8, 2024
c978a69
Merge branch 'weekly/10' into feat/#115-small-refactor
sanghee0820 Nov 8, 2024
6c544f8
Merge pull request #127 from kakao-tech-campus-2nd-step3/feat/#115-sm…
sanghee0820 Nov 8, 2024
59728c9
[fix] import 수정
sanghee0820 Nov 8, 2024
8acc1e8
[feat] 인플루언서들 이름 반환
wndlthsk Nov 8, 2024
d300e7e
Merge remote-tracking branch 'origin/weekly/10' into feat/#130-influe…
wndlthsk Nov 8, 2024
4b91389
[test] 주석 삭제
wndlthsk Nov 8, 2024
4910280
Merge pull request #131 from kakao-tech-campus-2nd-step3/feat/#130-in…
sanghee0820 Nov 8, 2024
ab3dc12
Merge pull request #132 from kakao-tech-campus-2nd-step3/weekly/10
sanghee0820 Nov 8, 2024
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
Prev Previous commit
Next Next commit
[refactor] 테스트 수정
wndlthsk committed Nov 8, 2024
commit 31f3070a2d8ca9500abc5dcb97b9a988ffc58130
Original file line number Diff line number Diff line change
@@ -16,13 +16,17 @@
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import team7.inplace.influencer.application.InfluencerService;
import team7.inplace.influencer.application.dto.InfluencerInfo;
import team7.inplace.influencer.presentation.InfluencerController;
import team7.inplace.influencer.presentation.dto.InfluencerListResponse;
import team7.inplace.influencer.presentation.dto.InfluencerResponse;

@ExtendWith(MockitoExtension.class)
@@ -40,31 +44,69 @@ public class InfluencerControllerTest {

@BeforeEach
public void setUp() {
mockMvc = MockMvcBuilders.standaloneSetup(influencerController).build();
PageableHandlerMethodArgumentResolver pageableArgumentResolver = new PageableHandlerMethodArgumentResolver();
mockMvc = MockMvcBuilders.standaloneSetup(influencerController)
.setCustomArgumentResolvers(pageableArgumentResolver)
.build();
objectMapper = new ObjectMapper();
}

// @Test
// public void getAllInfluencersTest() throws Exception {
// InfluencerInfo influencerInfo1 = new InfluencerInfo(1L, "influencer1", "imgUrl1", "job1",
// false);
// InfluencerInfo influencerInfo2 = new InfluencerInfo(2L, "influencer2", "imgUrl2", "job2",
// false);
// List<InfluencerInfo> influencerInfoList = List.of(influencerInfo1, influencerInfo2);
// given(influencerService.getAllInfluencers()).willReturn(influencerInfoList);
//
// // 예상 json 값
// List<InfluencerResponse> responseList = influencerInfoList.stream()
// .map(InfluencerResponse::from)
// .toList();
// InfluencerListResponse expectedResponse = new InfluencerListResponse(responseList);
// String expectedJson = objectMapper.writeValueAsString(expectedResponse);
//
// mockMvc.perform(get("/influencers")
// .contentType(MediaType.APPLICATION_JSON))
// .andDo(print())
// .andExpect(status().isOk())
// .andExpect(content().json(expectedJson));
// verify(influencerService, times(1)).getAllInfluencers(); // 서비스 호출 확인
// }
@Test
public void getAllInfluencersTest() throws Exception {
InfluencerInfo influencerInfo1 = new InfluencerInfo(1L, "influencer1", "imgUrl1", "job1",
false);
InfluencerInfo influencerInfo2 = new InfluencerInfo(2L, "influencer2", "imgUrl2", "job2",
false);
List<InfluencerInfo> influencerInfoList = List.of(influencerInfo1, influencerInfo2);
given(influencerService.getAllInfluencers()).willReturn(influencerInfoList);
InfluencerInfo influencerInfo1 = new InfluencerInfo(1L, "influencer1",
"imgUrl1", "job1", false);
InfluencerInfo influencerInfo2 = new InfluencerInfo(2L, "influencer2",
"imgUrl2", "job2", false);

// Pageable 객체 생성
Pageable pageable = PageRequest.of(0, 10);

// Page 객체 생성 (서비스에서 반환될 객체)
Page<InfluencerInfo> influencerInfoPage = new PageImpl<>(
List.of(influencerInfo1, influencerInfo2), pageable, 2);

// influencerService.getAllInfluencers(pageable)의 반환값을 모킹
given(influencerService.getAllInfluencers(pageable)).willReturn(influencerInfoPage);

// 예상 json 값
List<InfluencerResponse> responseList = influencerInfoList.stream()
.map(InfluencerResponse::from)
.toList();
InfluencerListResponse expectedResponse = new InfluencerListResponse(responseList);
String expectedJson = objectMapper.writeValueAsString(expectedResponse);
Page<InfluencerResponse> responsePage = influencerInfoPage.map(InfluencerResponse::from);
String expectedJson = objectMapper.writeValueAsString(responsePage);

// API 호출 및 검증
mockMvc.perform(get("/influencers")
.contentType(MediaType.APPLICATION_JSON))
.contentType(MediaType.APPLICATION_JSON)
.param("page", "0") // 페이지 번호
.param("size", "10")) // 페이지 크기
.andDo(print())
.andExpect(status().isOk())
.andExpect(content().json(expectedJson));
verify(influencerService, times(1)).getAllInfluencers(); // 서비스 호출 확인
.andExpect(status().isOk()) // HTTP 200 OK 응답 확인
.andExpect(content().json(expectedJson)); // JSON 응답이 예상값과 일치하는지 확인

// influencerService.getAllInfluencers(pageable) 메서드가 한 번 호출됐는지 검증
verify(influencerService, times(1)).getAllInfluencers(pageable);
}


}
60 changes: 41 additions & 19 deletions src/test/java/team7/inplace/influencer/InfluencerServiceTest.java
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.Set;
@@ -18,6 +17,10 @@
import org.mockito.Mock;
import org.mockito.MockedStatic;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import team7.inplace.favoriteInfluencer.domain.FavoriteInfluencer;
import team7.inplace.favoriteInfluencer.persistent.FavoriteInfluencerRepository;
import team7.inplace.influencer.application.InfluencerService;
@@ -44,38 +47,48 @@ public class InfluencerServiceTest {

@Test
public void getAllInfluencersTest_NotLoggedIn() {
Pageable pageable = PageRequest.of(0, 10);
MockedStatic<AuthorizationUtil> authorizationUtil = mockStatic(AuthorizationUtil.class);

Influencer influencer1 = new Influencer("influencer1", "imgUrl1", "job1");
Influencer influencer2 = new Influencer("influencer2", "imgUrl2", "job2");
Page<Influencer> influencersPage = new PageImpl<>(List.of(influencer1, influencer2));

given(influencerRepository.findAll()).willReturn(Arrays.asList(influencer1, influencer2));
given(influencerRepository.findAll(pageable)).willReturn(influencersPage);
given(AuthorizationUtil.getUserId()).willReturn(null);

List<InfluencerInfo> influencerInfoList = influencerService.getAllInfluencers();
Page<InfluencerInfo> influencerInfoPage = influencerService.getAllInfluencers(pageable);

assertThat(influencerInfoList).hasSize(2);
assertThat(influencerInfoList.get(0).influencerName()).isEqualTo("influencer1");
assertThat(influencerInfoList.get(0).likes()).isFalse();
assertThat(influencerInfoList.get(1).influencerName()).isEqualTo("influencer2");
assertThat(influencerInfoList.get(1).likes()).isFalse();
assertThat(influencerInfoPage).hasSize(2);
assertThat(influencerInfoPage.getContent().get(0))
.extracting("influencerName", "likes")
.containsExactly(influencer1.getName(), false);
assertThat(influencerInfoPage.getContent().get(1))
.extracting("influencerName", "likes")
.containsExactly(influencer2.getName(), false);
// assertThat(influencerInfoList.get(0).influencerName()).isEqualTo("influencer1");
// assertThat(influencerInfoList.get(0).likes()).isFalse();
// assertThat(influencerInfoList.get(1).influencerName()).isEqualTo("influencer2");
// assertThat(influencerInfoList.get(1).likes()).isFalse();

authorizationUtil.close();
}

@Test
public void getAllInfluencersTest_LoggedIn() {
Pageable pageable = PageRequest.of(0, 10);
MockedStatic<AuthorizationUtil> authorizationUtil = mockStatic(AuthorizationUtil.class);

Influencer influencer1 = new Influencer(1L, "influencer1", "imgUrl1", "job1");
Influencer influencer2 = new Influencer(2L, "influencer2", "imgUrl2", "job2");
Influencer influencer3 = new Influencer(3L, "influencer3", "imgUrl3", "job3");
Page<Influencer> influencersPage = new PageImpl<>(
List.of(influencer1, influencer2, influencer3));

Long userId = 1L;
User user = new User("name", "password", "nickname", UserType.KAKAO, Role.USER);

given(influencerRepository.findAll()).willReturn(
Arrays.asList(influencer1, influencer2, influencer3));
given(influencerRepository.findAll(pageable)).willReturn(influencersPage);
given(AuthorizationUtil.getUserId()).willReturn(userId);

// 2, 3번째 인플루언서 좋아요로 설정
@@ -86,15 +99,24 @@ public void getAllInfluencersTest_LoggedIn() {
given(favoriteInfluencerRepository.findLikedInfluencerIdsByUserId(userId)).willReturn(
Set.of(2L, 3L));

List<InfluencerInfo> influencerInfoList = influencerService.getAllInfluencers();

assertThat(influencerInfoList).hasSize(3);
assertThat(influencerInfoList.get(0).influencerName()).isEqualTo("influencer2");
assertThat(influencerInfoList.get(0).likes()).isTrue();
assertThat(influencerInfoList.get(1).influencerName()).isEqualTo("influencer3");
assertThat(influencerInfoList.get(1).likes()).isTrue();
assertThat(influencerInfoList.get(2).influencerName()).isEqualTo("influencer1");
assertThat(influencerInfoList.get(2).likes()).isFalse();
Page<InfluencerInfo> influencerInfoPage = influencerService.getAllInfluencers(pageable);

assertThat(influencerInfoPage).hasSize(3);
assertThat(influencerInfoPage.getContent().get(0))
.extracting("influencerName", "likes")
.containsExactly(influencer2.getName(), true);
assertThat(influencerInfoPage.getContent().get(1))
.extracting("influencerName", "likes")
.containsExactly(influencer3.getName(), true);
assertThat(influencerInfoPage.getContent().get(2))
.extracting("influencerName", "likes")
.containsExactly(influencer1.getName(), false);
// assertThat(influencerInfoList.get(0).influencerName()).isEqualTo("influencer2");
// assertThat(influencerInfoList.get(0).likes()).isTrue();
// assertThat(influencerInfoList.get(1).influencerName()).isEqualTo("influencer3");
// assertThat(influencerInfoList.get(1).likes()).isTrue();
// assertThat(influencerInfoList.get(2).influencerName()).isEqualTo("influencer1");
// assertThat(influencerInfoList.get(2).likes()).isFalse();

authorizationUtil.close();
}