Search in sources :

Example 1 with SeatRepositoryFake

use of com.management.fake.SeatRepositoryFake in project Internet-Software-Architectures by zivko11.

the class SeatManagerTests method AddingNewSeat_ReturnsBoolean.

@Test
public void AddingNewSeat_ReturnsBoolean() {
    // Arrange
    seatRepository = new SeatRepositoryFake();
    SeatDTO dto = new SeatDTO();
    dto.setSeatModified(new Date());
    dto.setSeatTaken(true);
    SeatManager manager = new SeatManager(seatRepository);
    // Act and assert
    Assert.assertNotNull(manager);
    Assert.assertTrue(manager.Create(dto));
    Seat seat = seatRepository.findOne(0);
    Assert.assertEquals(dto.getSeatId(), seat.getSeatId());
    Assert.assertEquals(dto.getSeatModified(), seat.getSeatModified());
    Assert.assertEquals(dto.isSeatTaken(), seat.isSeatTaken());
}
Also used : SeatDTO(com.management.dto.SeatDTO) Seat(com.management.entities.Seat) SeatRepositoryFake(com.management.fake.SeatRepositoryFake) Date(java.util.Date) Test(org.junit.Test)

Example 2 with SeatRepositoryFake

use of com.management.fake.SeatRepositoryFake in project Internet-Software-Architectures by zivko11.

the class SeatControllerTests method AddingNewSeat_ReturnsOK.

@Test
public void AddingNewSeat_ReturnsOK() {
    // Arrange
    seatRepository = new SeatRepositoryFake();
    SeatDTO dto = new SeatDTO();
    dto.setSeatModified(new Date());
    dto.setSeatTaken(true);
    SeatManager manager = new SeatManager(seatRepository);
    SeatController controller = new SeatController(manager);
    // Act and assert
    Assert.assertNotNull(controller);
    Assert.assertEquals(controller.addSeat(dto), new ResponseEntity<SeatDTO>(dto, HttpStatus.OK));
}
Also used : SeatDTO(com.management.dto.SeatDTO) SeatRepositoryFake(com.management.fake.SeatRepositoryFake) Date(java.util.Date) SeatManager(com.management.managers.SeatManager) Test(org.junit.Test)

Aggregations

SeatDTO (com.management.dto.SeatDTO)2 SeatRepositoryFake (com.management.fake.SeatRepositoryFake)2 Date (java.util.Date)2 Test (org.junit.Test)2 Seat (com.management.entities.Seat)1 SeatManager (com.management.managers.SeatManager)1