forked from Luke-Sikina/picsure-search-refinement
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDashboardControllerTest.java
34 lines (27 loc) · 1.06 KB
/
DashboardControllerTest.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
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.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ActiveProfiles;
import java.util.List;
@SpringBootTest
@ActiveProfiles("test")
class DashboardControllerTest {
@MockBean
private DashboardService service;
@Autowired
private DashboardController subject;
@Test
void shouldGetDashboard() {
Dashboard dashboard = new Dashboard(List.of(), List.of());
Mockito.when(service.getDashboard()).thenReturn(dashboard);
ResponseEntity<Dashboard> actual = subject.getDashboard();
Assertions.assertEquals(dashboard, actual.getBody());
Assertions.assertEquals(HttpStatus.OK, actual.getStatusCode());
}
}