Search in sources :

Example 1 with ActorRepositoryFake

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

the class ActorControllerTests method AddingNewActor_ReturnsOK.

@Test
public void AddingNewActor_ReturnsOK() {
    // Arrange
    Mockery mock = new Mockery();
    actorRepository = new ActorRepositoryFake();
    ActorDTO dto = new ActorDTO();
    dto.setAcName("Zivko");
    dto.setAcSurname("Stanisic");
    ActorManager manager = new ActorManager(actorRepository);
    ActorController controller = new ActorController(manager);
    // Act and assert
    Assert.assertNotNull(controller);
    Assert.assertEquals(controller.addActor(dto), new ResponseEntity<ActorDTO>(dto, HttpStatus.OK));
    mock.assertIsSatisfied();
}
Also used : ActorRepositoryFake(com.management.fake.ActorRepositoryFake) ActorDTO(com.management.dto.ActorDTO) Mockery(org.jmock.Mockery) ActorManager(com.management.managers.ActorManager) Test(org.junit.Test)

Example 2 with ActorRepositoryFake

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

the class ActorManagerTests method AddingNewActor_ReturnsBoolean.

@Test
public void AddingNewActor_ReturnsBoolean() {
    // Arrange
    Mockery mock = new Mockery();
    actorRepository = new ActorRepositoryFake();
    ActorDTO dto = new ActorDTO();
    dto.setAcName("Zivko");
    dto.setAcSurname("Stanisic");
    ActorManager manager = new ActorManager(actorRepository);
    // Act and assert
    Assert.assertNotNull(manager);
    Assert.assertTrue(manager.Create(dto));
    Actor actor = actorRepository.findOne(0);
    Assert.assertEquals(dto.getAcName(), actor.getAcName());
    Assert.assertEquals(dto.getAcSurname(), actor.getAcSurname());
    mock.assertIsSatisfied();
}
Also used : ActorRepositoryFake(com.management.fake.ActorRepositoryFake) ActorDTO(com.management.dto.ActorDTO) Actor(com.management.entities.Actor) Mockery(org.jmock.Mockery) Test(org.junit.Test)

Aggregations

ActorDTO (com.management.dto.ActorDTO)2 ActorRepositoryFake (com.management.fake.ActorRepositoryFake)2 Mockery (org.jmock.Mockery)2 Test (org.junit.Test)2 Actor (com.management.entities.Actor)1 ActorManager (com.management.managers.ActorManager)1