use of com.management.repositories.SeatRepository in project Internet-Software-Architectures by zivko11.
the class SeatControllerTests method ReadSeat_ReturnsOK.
@Test
public void ReadSeat_ReturnsOK() {
// Arrange
Mockery mock = new Mockery();
seatRepository = mock.mock(SeatRepository.class);
final Seat seat = new Seat();
seat.setSeatModified(new Date());
seat.setSeatTaken(true);
mock.checking(new Expectations() {
{
oneOf(seatRepository).findOne(1);
will(returnValue(seat));
}
});
SeatManager manager = new SeatManager(seatRepository);
SeatController controller = new SeatController(manager);
// Act
ResponseEntity<SeatDTO> response = controller.getSeat(1);
SeatDTO dto = response.getBody();
// Assert
Assert.assertNotNull(controller);
Assert.assertEquals(response, new ResponseEntity<SeatDTO>(dto, HttpStatus.OK));
mock.assertIsSatisfied();
}
Aggregations