use of com.management.repositories.FriendsListRepository in project Internet-Software-Architectures by zivko11.
the class FriendsListControllerTests method ReadFriendsList_ReturnsOK.
@Test
public void ReadFriendsList_ReturnsOK() {
// Arrange
Mockery mock = new Mockery();
friendsListRepository = mock.mock(FriendsListRepository.class);
final Friendslist list = new Friendslist();
list.setFriendsStatus('P');
mock.checking(new Expectations() {
{
oneOf(friendsListRepository).findOne(1);
will(returnValue(list));
}
});
FriendsListManager manager = new FriendsListManager(friendsListRepository);
FriendsListController controller = new FriendsListController(manager);
// Act
ResponseEntity<FriendslistDTO> response = controller.getFriendslist(1);
FriendslistDTO dto = response.getBody();
// Assert
Assert.assertNotNull(controller);
Assert.assertEquals(response, new ResponseEntity<FriendslistDTO>(dto, HttpStatus.OK));
mock.assertIsSatisfied();
}
Aggregations