File tree Expand file tree Collapse file tree 3 files changed +102
-1
lines changed
main/java/com/somemore/center/service Expand file tree Collapse file tree 3 files changed +102
-1
lines changed Original file line number Diff line number Diff line change 1- package com .somemore .center .usecase ;
1+ package com .somemore .center .service ;
22
33import com .somemore .center .domain .NEWCenter ;
44import com .somemore .center .repository .NEWCenterRepository ;
5+ import com .somemore .center .usecase .NEWCenterQueryUseCase ;
56import com .somemore .global .exception .ExceptionMessage ;
67import com .somemore .global .exception .NoSuchElementException ;
78import lombok .RequiredArgsConstructor ;
Original file line number Diff line number Diff line change 1+ package com .somemore .center .service ;
2+
3+ import com .somemore .center .domain .NEWCenter ;
4+ import com .somemore .center .repository .NEWCenterRepository ;
5+ import com .somemore .support .IntegrationTestSupport ;
6+ import org .junit .jupiter .api .BeforeEach ;
7+ import org .junit .jupiter .api .DisplayName ;
8+ import org .junit .jupiter .api .Test ;
9+ import org .springframework .beans .factory .annotation .Autowired ;
10+ import org .springframework .transaction .annotation .Transactional ;
11+
12+ import java .util .UUID ;
13+
14+ import static org .assertj .core .api .Assertions .assertThat ;
15+
16+ @ Transactional
17+ class NEWCenterQueryServiceTest extends IntegrationTestSupport {
18+
19+ @ Autowired
20+ private NEWCenterQueryService centerQueryService ;
21+
22+ @ Autowired
23+ private NEWCenterRepository centerRepository ;
24+
25+ UUID userId ;
26+ NEWCenter center ;
27+
28+ @ BeforeEach
29+ void setUp () {
30+ userId = UUID .randomUUID ();
31+ center = NEWCenter .createDefault (userId );
32+ centerRepository .save (center );
33+ }
34+
35+ @ Test
36+ @ DisplayName ("사용자 ID로 기관을 조회한다" )
37+ void getByUserId () {
38+ NEWCenter foundCenter = centerQueryService .getByUserId (userId );
39+
40+ assertThat (foundCenter ).isEqualTo (center );
41+ }
42+
43+ @ Test
44+ @ DisplayName ("사용자 ID로 기관 ID를 조회한다" )
45+ void getIdByUserId () {
46+ UUID foundCenterId = centerQueryService .getIdByUserId (userId );
47+
48+ assertThat (foundCenterId ).isEqualTo (center .getId ());
49+ }
50+ }
Original file line number Diff line number Diff line change 1+ package com .somemore .volunteer .service ;
2+
3+ import com .somemore .support .IntegrationTestSupport ;
4+ import com .somemore .volunteer .domain .NEWVolunteer ;
5+ import com .somemore .volunteer .repository .NEWVolunteerRepository ;
6+ import org .junit .jupiter .api .BeforeEach ;
7+ import org .junit .jupiter .api .DisplayName ;
8+ import org .junit .jupiter .api .Test ;
9+ import org .springframework .beans .factory .annotation .Autowired ;
10+ import org .springframework .transaction .annotation .Transactional ;
11+
12+ import java .util .UUID ;
13+
14+ import static org .assertj .core .api .Assertions .assertThat ;
15+
16+ @ Transactional
17+ class NEWVolunteerQueryServiceTest extends IntegrationTestSupport {
18+
19+ @ Autowired
20+ private NEWVolunteerQueryService volunteerQueryService ;
21+
22+ @ Autowired
23+ private NEWVolunteerRepository volunteerRepository ;
24+
25+ UUID userId ;
26+ NEWVolunteer volunteer ;
27+
28+ @ BeforeEach
29+ void setUp () {
30+ userId = UUID .randomUUID ();
31+ volunteer = NEWVolunteer .createDefault (userId );
32+ volunteerRepository .save (volunteer );
33+ }
34+
35+ @ Test
36+ @ DisplayName ("사용자 ID로 봉사자를 조회한다" )
37+ void getByUserId () {
38+ NEWVolunteer foundVolunteer = volunteerQueryService .getByUserId (userId );
39+
40+ assertThat (foundVolunteer ).isEqualTo (volunteer );
41+ }
42+
43+ @ Test
44+ @ DisplayName ("사용자 ID로 봉사자 ID를 조회한다" )
45+ void getIdByUserId () {
46+ UUID foundVolunteerId = volunteerQueryService .getIdByUserId (userId );
47+
48+ assertThat (foundVolunteerId ).isEqualTo (volunteer .getId ());
49+ }
50+ }
You can’t perform that action at this time.
0 commit comments