use of com.management.entities.Actorperformances in project Internet-Software-Architectures by zivko11.
the class ActorPerformancesManager method Read.
public ActorPerformancesDTO Read(int id) {
ModelMapper mapper = new ModelMapper();
ActorPerformancesDTO dto;
try {
Actorperformances actorPerformances = actorPerformancesRepository.findOne(id);
dto = mapper.map(actorPerformances, ActorPerformancesDTO.class);
} catch (Exception exc) {
exc.printStackTrace();
return null;
}
return dto;
}
use of com.management.entities.Actorperformances in project Internet-Software-Architectures by zivko11.
the class ActorPerformancesManager method Update.
public boolean Update(ActorPerformancesDTO dto) {
ModelMapper mapper = new ModelMapper();
Actorperformances tmp;
try {
tmp = mapper.map(dto, Actorperformances.class);
} catch (Exception exc) {
exc.printStackTrace();
return false;
}
actorPerformancesRepository.save(tmp);
return true;
}
use of com.management.entities.Actorperformances in project Internet-Software-Architectures by zivko11.
the class ActorPerformancesControllerTests method ReadActorPerformances_ReturnsOK.
@Test
public void ReadActorPerformances_ReturnsOK() {
// 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);
ActorPerformancesController controller = new ActorPerformancesController(manager);
// Act
ResponseEntity<ActorPerformancesDTO> response = controller.getActorPerformances(1);
ActorPerformancesDTO dto = response.getBody();
// Assert
Assert.assertNotNull(controller);
Assert.assertEquals(response, new ResponseEntity<ActorPerformancesDTO>(dto, HttpStatus.OK));
mock.assertIsSatisfied();
}
use of com.management.entities.Actorperformances in project Internet-Software-Architectures by zivko11.
the class ActorPerformancesControllerTests method ReadAllActorPerformances_ReturnsOK.
@Test
public void ReadAllActorPerformances_ReturnsOK() {
// 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);
ActorPerformancesController controller = new ActorPerformancesController(manager);
// Act
ResponseEntity<List<ActorPerformancesDTO>> response = controller.getActorPerformances();
ArrayList<ActorPerformancesDTO> listDTO = (ArrayList<ActorPerformancesDTO>) response.getBody();
// Assert
Assert.assertNotNull(controller);
Assert.assertEquals(response, new ResponseEntity<List<ActorPerformancesDTO>>(listDTO, HttpStatus.OK));
mock.assertIsSatisfied();
}
Aggregations