-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathLabFacadeTest.java
More file actions
76 lines (63 loc) · 2.12 KB
/
LabFacadeTest.java
File metadata and controls
76 lines (63 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package lab.application;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.List;
import kgu.developers.domain.file.domain.FileEntity;
import mock.repository.FakeFileRepository;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import kgu.developers.api.lab.application.LabFacade;
import kgu.developers.api.lab.presentation.response.LabDetailResponse;
import kgu.developers.api.lab.presentation.response.LabListResponse;
import kgu.developers.domain.lab.application.query.LabQueryService;
import kgu.developers.domain.lab.domain.Lab;
import mock.repository.FakeLabRepository;
public class LabFacadeTest {
private LabFacade labFacade;
@BeforeEach
public void init() {
FakeLabRepository fakeLabRepository = new FakeLabRepository();
FakeFileRepository fakeFileRepository = new FakeFileRepository();
labFacade = new LabFacade(
new LabQueryService(fakeLabRepository)
);
FileEntity testFile = fakeFileRepository.save(FileEntity.builder().id(1L).build());
fakeLabRepository.save(
Lab.create(
"인공지능 연구실",
"8502, 8503",
"http://ailab.kyonggi.ac.kr",
"김인철",
testFile
)
);
fakeLabRepository.save(
Lab.create(
"알고리즘 연구실",
"8504",
"http://algeo.kyonggi.ac.kr/",
"배상원",
testFile
)
);
}
@Test
@DisplayName("getLabs 메서드는 Lab 리스트를 최근 추가순으로 반환한다")
public void getLabs_Success() {
// when
LabListResponse response = labFacade.getLabs();
// then
List<LabDetailResponse> labs = response.contents();
assertEquals(2, labs.size());
LabDetailResponse lab1 = labs.get(0);
assertEquals("알고리즘 연구실", lab1.name());
assertEquals("8504", lab1.loc());
assertEquals("http://algeo.kyonggi.ac.kr/", lab1.site());
assertEquals("배상원", lab1.advisor());
LabDetailResponse lab2 = labs.get(1);
assertEquals("인공지능 연구실", lab2.name());
assertEquals("8502, 8503", lab2.loc());
assertEquals("http://ailab.kyonggi.ac.kr", lab2.site());
assertEquals("김인철", lab2.advisor());
}
}