use of eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.Service in project UVMS-ExchangeModule-APP by UnionVMS.
the class MapperTest method testUpsert.
@Test
public void testUpsert() {
String newValue = "NEW_VALUE";
Service entity = MockData.getEntity(1);
entity.setServiceCapabilityList(MockData.getEntityCapabilities(entity));
entity.setServiceSettingList(MockData.getEntitySettings(entity));
SettingListType updateSettings = new SettingListType();
SettingType updateSetting = new SettingType();
updateSetting.setKey(MockData.SETTING_KEY);
updateSetting.setValue(newValue);
updateSettings.getSetting().add(updateSetting);
List<ServiceSetting> list = mapper.mapSettingsList(entity, updateSettings, "TEST");
assertFalse(list.isEmpty());
for (ServiceSetting setting : list) {
assertSame(setting.getValue(), newValue);
}
SettingListType newSettings = new SettingListType();
SettingType newSetting = new SettingType();
newSetting.setKey("NEW.KEY");
newSetting.setValue("NEW.VALUE");
newSettings.getSetting().add(newSetting);
list = mapper.mapSettingsList(entity, newSettings, "TEST");
assertTrue(list.size() == 1);
}
Aggregations