44import static com .somemore .common .fixture .LocalDateTimeFixture .createUpdateStartDateTime ;
55import static com .somemore .recruitboard .domain .VolunteerType .ADMINISTRATIVE_SUPPORT ;
66import static com .somemore .recruitboard .domain .VolunteerType .OTHER ;
7- import static java .time .temporal .ChronoUnit .MINUTES ;
87import static org .assertj .core .api .Assertions .assertThat ;
98
109import com .somemore .IntegrationTestSupport ;
@@ -48,10 +47,8 @@ void setUp() {
4847 centerId = UUID .randomUUID ();
4948 recruitBoard = createRecruitBoard (centerId , location .getId ());
5049 recruitBoardRepository .saveAndFlush (recruitBoard );
51-
5250 }
5351
54-
5552 @ AfterEach
5653 void tearDown () {
5754 recruitBoardRepository .deleteAllInBatch ();
@@ -92,12 +89,10 @@ void updateRecruitBoard() {
9289 assertThat (volunteerInfo .getVolunteerType ()).isEqualTo (dto .volunteerType ());
9390 assertThat (volunteerInfo .getAdmitted ()).isEqualTo (dto .admitted ());
9491
95- assertThat (volunteerInfo .getVolunteerStartDateTime ().truncatedTo (MINUTES )
96- .compareTo (dto .volunteerStartDateTime ().truncatedTo (MINUTES )))
97- .isZero ();
98- assertThat (volunteerInfo .getVolunteerEndDateTime ().truncatedTo (MINUTES )
99- .compareTo (dto .volunteerEndDateTime ().truncatedTo (MINUTES )))
100- .isZero ();
92+ assertThat (volunteerInfo .getVolunteerStartDateTime ())
93+ .isEqualToIgnoringNanos (dto .volunteerStartDateTime ());
94+ assertThat (volunteerInfo .getVolunteerEndDateTime ())
95+ .isEqualToIgnoringNanos (dto .volunteerEndDateTime ());
10196 }
10297
10398 @ DisplayName ("봉사 모집글 위치를 수정할 수 있다" )
@@ -122,14 +117,17 @@ void updateRecruitBoardLocation() {
122117
123118 assertThat (updateRecruitBoard .getVolunteerInfo ().getRegion ()).isEqualTo (dto .region ());
124119 assertThat (updateLocation .getAddress ()).isEqualTo (dto .address ());
125- assertThat (updateLocation .getLongitude ().compareTo (dto .longitude ())).isZero ();
126- assertThat (updateLocation .getLatitude ().compareTo (dto .latitude ())).isZero ();
120+ assertThat (updateLocation .getLongitude ())
121+ .isEqualByComparingTo (dto .longitude ());
122+ assertThat (updateLocation .getLatitude ())
123+ .isEqualByComparingTo (dto .latitude ());
127124 }
128125
129126 @ DisplayName ("봉사 모집글은 작성자만 수정할 수 있다" )
130127 @ Test
131128 void updateRecruitBoardWhenCenterIdIsWrong () {
132129 // given
130+ Long id = recruitBoard .getId ();
133131 UUID wrongCenterId = UUID .randomUUID ();
134132 LocalDateTime newStartDateTime = createUpdateStartDateTime ();
135133 LocalDateTime newEndDateTime = newStartDateTime .plusHours (3 );
@@ -147,9 +145,7 @@ void updateRecruitBoardWhenCenterIdIsWrong() {
147145 // when
148146 // then
149147 Assertions .assertThatThrownBy (
150- () -> updateRecruitBoardService .updateRecruitBoard (dto , recruitBoard .getId (),
151- wrongCenterId ,
152- newImgUrl )
148+ () -> updateRecruitBoardService .updateRecruitBoard (dto , id , wrongCenterId , newImgUrl )
153149 ).isInstanceOf (BadRequestException .class );
154150
155151 }
0 commit comments