@@ -81,7 +81,8 @@ void setUp() {
8181 @ DisplayName ("내 다이어리 목록 조회" )
8282 void getMyMusicDiary () throws Exception {
8383 // given
84- DiaryEntity diary = diaryRepository .save (TestUtil .makeDiaryEntity (testUser ));
84+ DiaryEntity firstDiary = diaryRepository .save (TestUtil .makeDiaryEntity (testUser ));
85+ DiaryEntity secondDiary = diaryRepository .save (TestUtil .makeDiaryEntity (testUser ));
8586
8687 TestSecurityContextHolderInjection .inject (testUser .getId (), testUser .getRoleType ());
8788
@@ -106,13 +107,15 @@ void getMyMusicDiary() throws Exception {
106107 MyDiaryResponseDto diaryResponse = content .getFirst ();
107108
108109 assertSoftly (softly -> {
109- softly .assertThat (content ).hasSize (1 );
110- softly .assertThat (diaryResponse .musicTitle ()).isEqualTo (diary .getMusicTitle ());
111- softly .assertThat (diaryResponse .artist ()).isEqualTo (diary .getArtist ());
112- softly .assertThat (diaryResponse .duration ()).isEqualTo (diary .getDuration ());
113- softly .assertThat (diaryResponse .totalDuration ()).isEqualTo (diary .getTotalDuration ());
114- softly .assertThat (diaryResponse .start ()).isEqualTo (diary .getStart ());
115- softly .assertThat (diaryResponse .end ()).isEqualTo (diary .getEnd ());
110+ softly .assertThat (content ).hasSize (2 );
111+ softly .assertThat (diaryResponse .diaryId ()).isEqualTo (secondDiary .getId ());
112+ softly .assertThat (diaryResponse .musicTitle ()).isEqualTo (secondDiary .getMusicTitle ());
113+ softly .assertThat (diaryResponse .artist ()).isEqualTo (secondDiary .getArtist ());
114+ softly .assertThat (diaryResponse .duration ()).isEqualTo (secondDiary .getDuration ());
115+ softly .assertThat (diaryResponse .totalDuration ()).isEqualTo (secondDiary .getTotalDuration ());
116+ softly .assertThat (diaryResponse .start ()).isEqualTo (secondDiary .getStart ());
117+ softly .assertThat (diaryResponse .end ()).isEqualTo (secondDiary .getEnd ());
118+ softly .assertThat (content .getFirst ().diaryId () > content .getLast ().diaryId ()).isTrue ();
116119 });
117120 }
118121
@@ -151,6 +154,7 @@ void getUserDiariesByViewer() throws Exception {
151154 assertSoftly (softly -> {
152155 softly .assertThat (content ).hasSize (2 );
153156 softly .assertThat (responseMap .containsKey (privateDiary .getId ())).isFalse ();
157+ softly .assertThat (content .getFirst ().diaryId () > content .getLast ().diaryId ()).isTrue ();
154158
155159 // PUBLIC
156160 UserDiaryResponseDto publicResponse = responseMap .get (publicDiary .getId ());
@@ -195,6 +199,7 @@ void getMyDiariesByPeriod() throws Exception {
195199 List <MyDiaryResponseDto > content = objectMapper .readValue (response , new TypeReference <>() {});
196200
197201 assertSoftly (softly -> {
202+ softly .assertThat (content .getFirst ().diaryId () > content .getLast ().diaryId ()).isTrue ();
198203 softly .assertThat (content ).hasSize (2 );
199204 });
200205 }
@@ -209,9 +214,11 @@ void getMyDiariesFeeds() throws Exception {
209214 Subscribe subscribe = new Subscribe (testUser , subscribedToUser );
210215 subscribeRepository .save (subscribe );
211216
217+ DiaryEntity otherFeedDiary = diaryRepository .save (TestUtil .makeDiaryEntity (subscribedToUser ));
218+ // 좋아요 누를 다이어를 두 번째로 저장
219+ DiaryEntity likedFeedDiary = diaryRepository .save (TestUtil .makeDiaryEntity (subscribedToUser ));
212220 // 좋아요 누르기
213- DiaryEntity feedDiary = diaryRepository .save (TestUtil .makeDiaryEntity (subscribedToUser ));
214- DiaryLikeEntity diaryLikeEntity = diaryLikeLowService .saveDiaryLike (new DiaryLikeEntity (testUser , feedDiary ));
221+ DiaryLikeEntity diaryLikeEntity = diaryLikeLowService .saveDiaryLike (new DiaryLikeEntity (testUser , likedFeedDiary ));
215222
216223 // 구독하지 않은 회원
217224 UserEntity otherUser = userRepository .save (TestUtil .makeDifferentUserEntity (subscribedToUser ));
@@ -237,11 +244,12 @@ void getMyDiariesFeeds() throws Exception {
237244 FeedDiaryResponseDto feedDiaryResponseDto = content .getFirst ();
238245
239246 assertSoftly (softly -> {
240- softly .assertThat (content ).hasSize (1 );
241- softly .assertThat (feedDiaryResponseDto .diaryId ()).isEqualTo (feedDiary .getId ());
247+ softly .assertThat (content ).hasSize (2 );
248+ softly .assertThat (feedDiaryResponseDto .diaryId ()).isEqualTo (likedFeedDiary .getId ());
242249 softly .assertThat (feedDiaryResponseDto .isLiked ()).isTrue ();
243250 softly .assertThat (feedDiaryResponseDto .likeCount ()).isEqualTo (1L );
244251 softly .assertThat (feedDiaryResponseDto .userId ()).isEqualTo (subscribedToUser .getId ());
252+ softly .assertThat (content .getFirst ().diaryId () > content .getLast ().diaryId ()).isTrue ();
245253 });
246254 }
247255
0 commit comments