use of com.management.dto.ActorPerformancesDTO in project Internet-Software-Architectures by zivko11.
the class ActorPerformancesControllerTests method DeletingActorPerformances_ReturnsOK.
@Test
public void DeletingActorPerformances_ReturnsOK() {
// Arrange
Mockery mock = new Mockery();
actorReprformancesRepository = mock.mock(ActorPerformancesRepository.class);
// expectations
mock.checking(new Expectations() {
{
oneOf(actorReprformancesRepository).delete(1);
}
});
// Act and assert
ActorPerformancesManager manager = new ActorPerformancesManager(actorReprformancesRepository);
ActorPerformancesController controller = new ActorPerformancesController(manager);
Assert.assertNotNull(controller);
Assert.assertEquals(controller.deleteActorPerformances(1), new ResponseEntity<ActorPerformancesDTO>(HttpStatus.OK));
mock.assertIsSatisfied();
}
use of com.management.dto.ActorPerformancesDTO in project Internet-Software-Architectures by zivko11.
the class ActorPerformancesControllerTests method AddingNewActorPerformances_ReturnsOK.
@Test
public void AddingNewActorPerformances_ReturnsOK() {
// Arrange
actorReprformancesRepository = new ActorPerformancesRepositoryFake();
ActorPerformancesDTO dto = new ActorPerformancesDTO();
ActorPerformancesManager manager = new ActorPerformancesManager(actorReprformancesRepository);
ActorPerformancesController controller = new ActorPerformancesController(manager);
// Act and assert
Assert.assertNotNull(controller);
Assert.assertEquals(controller.addActorPerformances(dto), new ResponseEntity<ActorPerformancesDTO>(dto, HttpStatus.OK));
}
use of com.management.dto.ActorPerformancesDTO in project Internet-Software-Architectures by zivko11.
the class ActorPerformancesManagerTests method ReadAllActorPerformances_ReturnsAllActorPerformances.
@Test
public void ReadAllActorPerformances_ReturnsAllActorPerformances() {
// Arrange
Mockery mock = new Mockery();
actorReprformancesRepository = mock.mock(ActorPerformancesRepository.class);
final ArrayList<Actorperformances> list = new ArrayList<Actorperformances>();
Actorperformances ap1 = new Actorperformances();
Actorperformances ap2 = new Actorperformances();
list.add(ap1);
list.add(ap2);
mock.checking(new Expectations() {
{
oneOf(actorReprformancesRepository).findAll();
will(returnValue(list));
}
});
ActorPerformancesManager manager = new ActorPerformancesManager(actorReprformancesRepository);
// Act
ArrayList<ActorPerformancesDTO> listDTO = manager.ReadAll();
// Assert
Assert.assertNotNull(listDTO);
Assert.assertEquals(listDTO.get(0).getApId(), list.get(0).getApId());
Assert.assertEquals(listDTO.get(1).getApId(), list.get(1).getApId());
mock.assertIsSatisfied();
}
use of com.management.dto.ActorPerformancesDTO in project Internet-Software-Architectures by zivko11.
the class ActorPerformancesManagerTests method ReadActorPerformances_ReturnsActorPerformances.
@Test
public void ReadActorPerformances_ReturnsActorPerformances() {
// Arrange
Mockery mock = new Mockery();
actorReprformancesRepository = mock.mock(ActorPerformancesRepository.class);
final Actorperformances ap = new Actorperformances();
mock.checking(new Expectations() {
{
oneOf(actorReprformancesRepository).findOne(1);
will(returnValue(ap));
}
});
ActorPerformancesManager manager = new ActorPerformancesManager(actorReprformancesRepository);
// Act
ActorPerformancesDTO dto = manager.Read(1);
// Assert
Assert.assertNotNull(dto);
Assert.assertEquals(dto.getApId(), ap.getApId());
mock.assertIsSatisfied();
}
use of com.management.dto.ActorPerformancesDTO in project Internet-Software-Architectures by zivko11.
the class ActorPerformancesManagerTests method AddingNewActorPerformances_ReturnsBoolean.
@Test
public void AddingNewActorPerformances_ReturnsBoolean() {
// Arrange
actorReprformancesRepository = new ActorPerformancesRepositoryFake();
ActorPerformancesDTO dto = new ActorPerformancesDTO();
ActorPerformancesManager manager = new ActorPerformancesManager(actorReprformancesRepository);
// Act and assert
Assert.assertNotNull(manager);
Assert.assertTrue(manager.Create(dto));
Actorperformances ap = actorReprformancesRepository.findOne(0);
Assert.assertEquals(dto.getApId(), ap.getApId());
}
Aggregations