### Question:
CustomDataSourceResourceConverter extends ResourceConverterImpl<CustomReportDataSource, ClientCustomDataSource> { @Override protected CustomReportDataSource resourceSpecificFieldsToServer(ClientCustomDataSource clientObject, CustomReportDataSource resultToUpdate, List<Exception> exceptions, ToServerConversionOptions options) throws IllegalParameterValueException { resultToUpdate.setDataSourceName(clientObject.getDataSourceName()); final CustomDataSourceDefinition definition = customDataSourceFactory.getDefinitionByName(clientObject.getDataSourceName()); if (definition != null) { resultToUpdate.setServiceClass(definition.getServiceClassName()); } Map<String, Object> properties = new HashMap<String, Object>(); final Map resultToUpdatePropertyMap = resultToUpdate.getPropertyMap(); if (resultToUpdatePropertyMap != null && !resultToUpdatePropertyMap.isEmpty()) { for (String currentPropertyToIgnore : propertiesToIgnore) { if (resultToUpdatePropertyMap.containsKey(currentPropertyToIgnore)) { properties.put(currentPropertyToIgnore, resultToUpdatePropertyMap.get(currentPropertyToIgnore)); } } } final List<ClientProperty> clientProperties = clientObject.getProperties(); if (clientProperties != null && !clientProperties.isEmpty()) { for (ClientProperty property : clientProperties) { final String propertyKey = property.getKey(); final String propertyValue = property.getValue(); if ((propertiesToIgnore.contains(propertyKey) && propertyValue != null) || !propertiesToIgnore.contains(propertyValue)) { properties.put(propertyKey, propertyValue); } } } resultToUpdate.setPropertyMap(properties.isEmpty() ? null : properties); resultToUpdate.setResources(convertResourcesToServer(clientObject.getResources(), options)); return resultToUpdate; }    }### Answer:
@Test public void resourceSpecificFieldsToServer() throws Exception { final String ignoredServiceClass = "testServiceClass"; final String expectedDataSourceName = "testDataSourceName"; final String expectedPropertyKey1 = "testPropertyKey1"; final String expectedPropertyKey2 = "testPropertyKey2"; final String expectedPropertyKey3 = "testPropertyKey3"; final String expectedPropertyValue1 = "testPropertyValue1"; final String expectedPropertyValue2 = "testPropertyValue2"; propertiesToIgnore.add(expectedPropertyKey3); final CustomDataSourceDefinition customDataSourceDefinition = mock(CustomDataSourceDefinition.class); final String definedServiceClassName = "definedServiceClassName"; when(customDataSourceDefinition.getServiceClassName()).thenReturn(definedServiceClassName); when(customDataSourceFactory.getDefinitionByName(expectedDataSourceName)).thenReturn(customDataSourceDefinition); final ClientCustomDataSource clientObject = new ClientCustomDataSource(); clientObject.setServiceClass(ignoredServiceClass); clientObject.setDataSourceName(expectedDataSourceName); List<ClientProperty> properties = new ArrayList<ClientProperty>(); properties.add(new ClientProperty(expectedPropertyKey1, expectedPropertyValue1)); properties.add(new ClientProperty(expectedPropertyKey2, expectedPropertyValue2)); clientObject.setProperties(properties); final CustomReportDataSource serverObject = new CustomReportDataSourceImpl(); serverObject.setPropertyMap(new HashMap(){{ put(expectedPropertyKey1, "valueToReplace"); put(expectedPropertyKey2, "valueToReplace"); put(expectedPropertyKey3, "valueToStay"); }}); final CustomReportDataSource result = converter.resourceSpecificFieldsToServer(clientObject, serverObject, new ArrayList<Exception>(), null); assertSame(result, serverObject); assertEquals(result.getServiceClass(), definedServiceClassName); assertEquals(result.getDataSourceName(), expectedDataSourceName); final Map<String, String> propertyMap = result.getPropertyMap(); assertNotNull(propertyMap); assertEquals(propertyMap.size(), 3); assertEquals(propertyMap.get(expectedPropertyKey1), expectedPropertyValue1); assertEquals(propertyMap.get(expectedPropertyKey2), expectedPropertyValue2); assertEquals(propertyMap.get(expectedPropertyKey3), "valueToStay"); }