File tree Expand file tree Collapse file tree 2 files changed +21
-18
lines changed
src/test/java/com/somemore/volunteerapply Expand file tree Collapse file tree 2 files changed +21
-18
lines changed Original file line number Diff line number Diff line change @@ -51,12 +51,7 @@ void setUp() {
5151 @ Test
5252 void saveAndFindById () {
5353 // Given
54- VolunteerApply newApply = VolunteerApply .builder ()
55- .volunteerId (UUID .randomUUID ())
56- .recruitBoardId (1L )
57- .status (ApplyStatus .APPROVED )
58- .attended (false )
59- .build ();
54+ VolunteerApply newApply = createApply (UUID .randomUUID (), 1L );
6055 VolunteerApply savedApply = volunteerApplyRepository .save (newApply );
6156
6257 // When
@@ -111,12 +106,7 @@ void findByRecruitIdAndVolunteerId() {
111106 Long recruitId = 1234L ;
112107 UUID volunteerId = UUID .randomUUID ();
113108
114- VolunteerApply newApply = VolunteerApply .builder ()
115- .volunteerId (volunteerId )
116- .recruitBoardId (recruitId )
117- .status (ApplyStatus .APPROVED )
118- .attended (false )
119- .build ();
109+ VolunteerApply newApply = createApply (volunteerId , recruitId );
120110 volunteerApplyRepository .save (newApply );
121111
122112 // when
@@ -126,4 +116,13 @@ void findByRecruitIdAndVolunteerId() {
126116 // then
127117 assertThat (findApply ).isPresent ();
128118 }
119+
120+ private static VolunteerApply createApply (UUID volunteerId , Long recruitId ) {
121+ return VolunteerApply .builder ()
122+ .volunteerId (volunteerId )
123+ .recruitBoardId (recruitId )
124+ .status (ApplyStatus .APPROVED )
125+ .attended (false )
126+ .build ();
127+ }
129128}
Original file line number Diff line number Diff line change @@ -63,12 +63,7 @@ void getByRecruitIdAndVolunteerId() {
6363 Long recruitId = 1234L ;
6464 UUID volunteerId = UUID .randomUUID ();
6565
66- VolunteerApply newApply = VolunteerApply .builder ()
67- .volunteerId (volunteerId )
68- .recruitBoardId (recruitId )
69- .status (ApplyStatus .APPROVED )
70- .attended (false )
71- .build ();
66+ VolunteerApply newApply = createApply (volunteerId , recruitId );
7267 volunteerApplyRepository .save (newApply );
7368
7469 // when
@@ -79,4 +74,13 @@ void getByRecruitIdAndVolunteerId() {
7974 assertThat (apply .getRecruitBoardId ()).isEqualTo (recruitId );
8075 assertThat (apply .getVolunteerId ()).isEqualTo (volunteerId );
8176 }
77+
78+ private static VolunteerApply createApply (UUID volunteerId , Long recruitId ) {
79+ return VolunteerApply .builder ()
80+ .volunteerId (volunteerId )
81+ .recruitBoardId (recruitId )
82+ .status (ApplyStatus .APPROVED )
83+ .attended (false )
84+ .build ();
85+ }
8286}
You can’t perform that action at this time.
0 commit comments