use of com.nike.cerberus.domain.SafeDepositBoxV2 in project cerberus by Nike-Inc.
the class SafeDepositBoxControllerV2Test method testCreateSafeDepositBox.
@Test
public void testCreateSafeDepositBox() {
SafeDepositBoxV2 safeDepositBoxV2 = Mockito.mock(SafeDepositBoxV2.class);
Mockito.when(safeDepositBoxV2.getId()).thenReturn("id");
Authentication authentication = Mockito.mock(Authentication.class);
Mockito.when(authentication.getName()).thenReturn("name");
Mockito.when(safeDepositBoxService.createSafeDepositBoxV2(safeDepositBoxV2, "name")).thenReturn(safeDepositBoxV2);
UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.newInstance();
ResponseEntity<SafeDepositBoxV2> safeDepositBoxResponseEntity = safeDepositBoxControllerV2.createSafeDepositBox(safeDepositBoxV2, authentication, uriComponentsBuilder);
Assert.assertSame(safeDepositBoxV2, safeDepositBoxResponseEntity.getBody());
HttpHeaders headers = safeDepositBoxResponseEntity.getHeaders();
Assert.assertEquals("/V2/safe-deposit-box/id", headers.get("Location").get(0));
}
Aggregations