Search in sources :

Example 1 with CinemaTheatreRepositoryFake

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

the class CinemaTheatreManagerTests method AddingNewCinemaTheatre_ReturnsBoolean.

@Test
public void AddingNewCinemaTheatre_ReturnsBoolean() {
    // Arrange
    cinemaTheatreRepository = new CinemaTheatreRepositoryFake();
    CinemaTheatreDTO dto = new CinemaTheatreDTO();
    dto.setCtAdress("Bulevar oslobodjenja 11");
    dto.setCtDescription("Ovo je opis.");
    dto.setCtName("Bioskop");
    dto.setCtPhone(1234567890);
    CinemaTheatreManager manager = new CinemaTheatreManager(cinemaTheatreRepository);
    // Act and assert
    Assert.assertNotNull(manager);
    Assert.assertTrue(manager.Create(dto));
    CinemaTheatre cinemaTheatre = cinemaTheatreRepository.findOne(0);
    Assert.assertEquals(dto.getCtAdress(), cinemaTheatre.getCtAdress());
    Assert.assertEquals(dto.getCtDescription(), cinemaTheatre.getCtDescription());
    Assert.assertEquals(dto.getCtName(), cinemaTheatre.getCtName());
    Assert.assertEquals(dto.getCtPhone(), cinemaTheatre.getCtPhone());
}
Also used : CinemaTheatreRepositoryFake(com.management.fake.CinemaTheatreRepositoryFake) CinemaTheatreDTO(com.management.dto.CinemaTheatreDTO) CinemaTheatre(com.management.entities.CinemaTheatre) Test(org.junit.Test)

Example 2 with CinemaTheatreRepositoryFake

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

the class CinemaTheatreControllerTests method AddingNewCinemaTheatre_ReturnsOK.

@Test
public void AddingNewCinemaTheatre_ReturnsOK() {
    // Arrange
    cinemaTheatreRepository = new CinemaTheatreRepositoryFake();
    CinemaTheatreDTO dto = new CinemaTheatreDTO();
    dto.setCtAdress("Bulevar oslobodjenja 11");
    dto.setCtDescription("Ovo je opis.");
    dto.setCtName("Bioskop");
    dto.setCtPhone(1234567890);
    CinemaTheatreManager manager = new CinemaTheatreManager(cinemaTheatreRepository);
    CinemaTheatreController controller = new CinemaTheatreController(manager);
    // Act and assert
    Assert.assertNotNull(controller);
    Assert.assertEquals(controller.addCinemaTheatre(dto), new ResponseEntity<CinemaTheatreDTO>(dto, HttpStatus.OK));
}
Also used : CinemaTheatreManager(com.management.managers.CinemaTheatreManager) CinemaTheatreRepositoryFake(com.management.fake.CinemaTheatreRepositoryFake) CinemaTheatreDTO(com.management.dto.CinemaTheatreDTO) Test(org.junit.Test)

Aggregations

CinemaTheatreDTO (com.management.dto.CinemaTheatreDTO)2 CinemaTheatreRepositoryFake (com.management.fake.CinemaTheatreRepositoryFake)2 Test (org.junit.Test)2 CinemaTheatre (com.management.entities.CinemaTheatre)1 CinemaTheatreManager (com.management.managers.CinemaTheatreManager)1