forked from Luke-Sikina/picsure-search-refinement
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDashboardServiceTest.java
36 lines (28 loc) · 1016 Bytes
/
DashboardServiceTest.java
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
package edu.harvard.dbmi.avillach.dictionary.dashboard;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.ActiveProfiles;
import java.util.List;
import java.util.Map;
@SpringBootTest
@ActiveProfiles("test")
class DashboardServiceTest {
@MockBean
DashboardRepository repository;
@MockBean
List<DashboardColumn> columns;
@Autowired
DashboardService subject;
@Test
void shouldGetDashboard() {
List<Map<String, String>> rows = List.of(Map.of("a", "1", "b", "2"));
Mockito.when(repository.getRows()).thenReturn(rows);
Dashboard actual = subject.getDashboard();
Dashboard expected = new Dashboard(columns, rows);
Assertions.assertEquals(expected, actual);
}
}