use of eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.Service in project UVMS-ExchangeModule-APP by UnionVMS.
the class MapperTest method testEntityToModel.
// private void mockDaoToEntity() throws ExchangeDaoException {
// when(enumDao.getMyEntityEnum(any(MyEntityEnumSource.class))).thenReturn(MyEntityEnum.VALUE_1);
// }
@Test
public void testEntityToModel() throws ExchangeDaoException, ExchangeDaoMappingException {
Integer id = 1;
Service entity = MockData.getEntity(id);
List<ServiceCapability> capabilityList = new ArrayList<>();
entity.setServiceCapabilityList(capabilityList);
List<ServiceSetting> settingList = new ArrayList<>();
entity.setServiceSettingList(settingList);
// mockDaoToEntity();
ServiceType result = mapper.toServiceModel(entity);
assertSame(entity.getName(), result.getName());
assertSame(entity.getServiceClassName(), result.getServiceClassName());
}
use of eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.Service in project UVMS-ExchangeModule-APP by UnionVMS.
the class MapperTest method testEntityAndModelToModel.
@Test
public void testEntityAndModelToModel() throws ExchangeDaoException, ExchangeDaoMappingException {
Service entity = MockData.getEntity(1);
List<ServiceCapability> capabilityList = new ArrayList<>();
entity.setServiceCapabilityList(capabilityList);
List<ServiceSetting> settingList = new ArrayList<>();
entity.setServiceSettingList(settingList);
// mockDaoToEntity();
ServiceType result = mapper.toServiceModel(entity);
assertSame(entity.getName(), result.getName());
assertSame(entity.getServiceClassName(), result.getServiceClassName());
}
use of eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.Service in project UVMS-ExchangeModule-APP by UnionVMS.
the class MapperTest method testModelToEntity.
@Test
public void testModelToEntity() throws ExchangeDaoException, ExchangeDaoMappingException {
Integer id = 1;
ServiceType model = MockData.getModel(id);
CapabilityListType capabilityListType = MockData.getCapabilityList();
SettingListType settingListType = MockData.getSettingList();
// mockDaoToEntity();
Service result = mapper.toServiceEntity(model, capabilityListType, settingListType, "TEST");
assertSame(model.getName(), result.getName());
assertSame(model.getServiceClassName(), result.getServiceClassName());
}
use of eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.Service in project UVMS-ExchangeModule-APP by UnionVMS.
the class DaoBeanTest method testUpdateService.
@Test
public void testUpdateService() throws ExchangeDaoException {
Long id = 11L;
Service myEntity = new Service();
myEntity.setId(id);
Service result = new Service();
result.setId(id);
when(em.merge(myEntity)).thenReturn(result);
Service resultEntity = dao.updateService(myEntity);
verify(em).merge(myEntity);
assertSame(id, resultEntity.getId());
}
use of eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.Service in project UVMS-ExchangeModule-APP by UnionVMS.
the class DaoBeanTest method testGetServiceById.
@Test
public void testGetServiceById() throws ExchangeDaoException {
Long id = 1L;
Service entity = new Service();
entity.setId(id);
when(em.find(Service.class, id)).thenReturn(entity);
Service result = dao.getEntityById(id.toString());
verify(em).find(Service.class, id);
assertSame(id, result.getId());
}
Aggregations