Search in sources :

Example 1 with FanZoneRepositoryFake

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

the class FanZoneControllerTests method AddingNewFanZone_ReturnsOK.

@Test
public void AddingNewFanZone_ReturnsOK() {
    // Arrange
    Mockery mock = new Mockery();
    fanZoneRepository = new FanZoneRepositoryFake();
    FanZoneDTO dto = new FanZoneDTO();
    dto.setFanZoneName("Spodermna fan zone");
    FanZoneManager manager = new FanZoneManager(fanZoneRepository);
    FanZoneController controller = new FanZoneController(manager);
    // Act and assert
    Assert.assertNotNull(controller);
    Assert.assertEquals(controller.addFanZone(dto), new ResponseEntity<FanZoneDTO>(dto, HttpStatus.OK));
    mock.assertIsSatisfied();
}
Also used : FanZoneManager(com.management.managers.FanZoneManager) FanZoneRepositoryFake(com.management.fake.FanZoneRepositoryFake) FanZoneDTO(com.management.dto.FanZoneDTO) Mockery(org.jmock.Mockery) Test(org.junit.Test)

Example 2 with FanZoneRepositoryFake

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

the class FanZoneManagerTests method AddingNewFanZone_ReturnsBoolean.

@Test
public void AddingNewFanZone_ReturnsBoolean() {
    // Arrange
    fanZoneRepository = new FanZoneRepositoryFake();
    FanZoneDTO dto = new FanZoneDTO();
    dto.setFanZoneName("Spoderman Fan Zone");
    FanZoneManager manager = new FanZoneManager(fanZoneRepository);
    // Act and assert
    Assert.assertNotNull(manager);
    Assert.assertTrue(manager.Create(dto));
    FanZone fz = fanZoneRepository.findOne(0);
    Assert.assertEquals(dto.getFanZoneId(), fz.getFanZoneId());
    Assert.assertEquals(dto.getFanZoneName(), dto.getFanZoneName());
}
Also used : FanZoneRepositoryFake(com.management.fake.FanZoneRepositoryFake) FanZoneDTO(com.management.dto.FanZoneDTO) FanZone(com.management.entities.FanZone) Test(org.junit.Test)

Aggregations

FanZoneDTO (com.management.dto.FanZoneDTO)2 FanZoneRepositoryFake (com.management.fake.FanZoneRepositoryFake)2 Test (org.junit.Test)2 FanZone (com.management.entities.FanZone)1 FanZoneManager (com.management.managers.FanZoneManager)1 Mockery (org.jmock.Mockery)1