File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
src/test/java/com/somemore/recruitboard Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,10 @@ void createRecruitBoardWithInValidVolunteerTime(long secondsOffset) {
7070 @ Test
7171 void testCalculateVolunteerTime () {
7272 // given
73+ int hours = 3 ;
74+ LocalDateTime startDateTime = LocalDateTime .now ();
75+ LocalDateTime endDateTime = startDateTime .plusHours (hours );
76+
7377 RecruitBoard board = RecruitBoard .builder ()
7478 .centerId (UUID .randomUUID ())
7579 .locationId (1L )
@@ -78,8 +82,8 @@ void testCalculateVolunteerTime() {
7882 .region ("경기" )
7983 .recruitmentCount (10 )
8084 .imgUrl ("https://image.domain.com/links" )
81- .volunteerStartDateTime (LocalDateTime . now () )
82- .volunteerEndDateTime (LocalDateTime . now (). plusHours ( 3 ) )
85+ .volunteerStartDateTime (startDateTime )
86+ .volunteerEndDateTime (endDateTime )
8387 .volunteerType (OTHER )
8488 .admitted (true )
8589 .build ();
@@ -88,6 +92,6 @@ void testCalculateVolunteerTime() {
8892 LocalTime volunteerTime = board .calculateVolunteerTime ();
8993
9094 // then
91- assertThat (volunteerTime ).isEqualTo (LocalTime .of (3 , 0 ));
95+ assertThat (volunteerTime ).isEqualTo (LocalTime .of (hours , 0 ));
9296 }
9397}
Original file line number Diff line number Diff line change 1111import com .somemore .recruitboard .repository .RecruitBoardRepository ;
1212import java .math .BigDecimal ;
1313import java .time .LocalDateTime ;
14- import java .time .LocalTime ;
1514import java .util .Optional ;
1615import java .util .UUID ;
1716import org .junit .jupiter .api .AfterEach ;
@@ -71,7 +70,6 @@ void createRecruitBoardWithDto() {
7170 assertThat (recruitBoard .get ().getId ()).isEqualTo (saveId );
7271 assertThat (recruitBoard .get ().getCenterId ()).isEqualTo (centerId );
7372 assertThat (recruitBoard .get ().getImgUrl ()).isEqualTo (imgUrl );
74- assertThat (recruitBoard .get ().calculateVolunteerTime ()).isEqualTo (LocalTime .of (2 , 0 ));
7573 }
7674
7775}
You can’t perform that action at this time.
0 commit comments