### Question:
CustomDataSourceResourceConverter extends ResourceConverterImpl<CustomReportDataSource, ClientCustomDataSource> { @Override protected void resourceSecureFieldsToClient(ClientCustomDataSource client, CustomReportDataSource serverObject, ToClientConversionOptions options) { final Map propertyMap = serverObject.getPropertyMap(); if (propertyMap != null && !propertyMap.isEmpty()) { final Set<String> set = propertyMap.keySet(); for (String key : set) { if (propertiesToIgnore.contains(key)) { if (client.getProperties() == null) { client.setProperties(new ArrayList<ClientProperty>()); } else { client.setProperties(new ArrayList<ClientProperty>(client.getProperties())); } client.getProperties().add(new ClientProperty(key, (String)propertyMap.get(key))); } } } }    }### Answer:
@Test public void resourceSecureFieldsToClient_clientPropsIsNull_resultContainsOneIgnoredProps() { final String expectedPropertyKey = "testPropertyKey1"; final String expectedPropertyValue = "testPropertyValue1"; final ClientCustomDataSource clientObject = new ClientCustomDataSource(); final CustomReportDataSource serverObject = new CustomReportDataSourceImpl(); Map<String, String> properties = new HashMap<String, String>(); properties.put(expectedPropertyKey, expectedPropertyValue); serverObject.setPropertyMap(properties); propertiesToIgnore.add(expectedPropertyKey); converter.resourceSecureFieldsToClient(clientObject, serverObject, null); final List<ClientProperty> resultProperties = clientObject.getProperties(); assertNotNull(resultProperties); assertEquals(resultProperties.size(), 1); assertEquals(resultProperties.get(0).getKey(), expectedPropertyKey); assertEquals(resultProperties.get(0).getValue(), expectedPropertyValue); }
@Test public void resourceSecureFieldsToClient_clientPropsContainsOneElement_resultContainsTwoProps() { final String expectedPropertyKey = "testPropertyKey1"; final String expectedPropertyValue = "testPropertyValue1"; final String existingPropertyKey = "testPropertyKey2"; final String existingPropertyValue = "testPropertyValue2"; List<ClientProperty> existingProps = Arrays.asList(new ClientProperty(existingPropertyKey, existingPropertyValue)); final ClientCustomDataSource clientObject = new ClientCustomDataSource().setProperties(existingProps); final CustomReportDataSource serverObject = new CustomReportDataSourceImpl(); Map<String, String> properties = new HashMap<String, String>(); properties.put(expectedPropertyKey, expectedPropertyValue); serverObject.setPropertyMap(properties); propertiesToIgnore.add(expectedPropertyKey); converter.resourceSecureFieldsToClient(clientObject, serverObject, null); final List<ClientProperty> resultProperties = clientObject.getProperties(); assertNotNull(resultProperties); assertEquals(resultProperties.size(), 2); assertEquals(resultProperties.get(0).getKey(), existingPropertyKey); assertEquals(resultProperties.get(0).getValue(), existingPropertyValue); assertEquals(resultProperties.get(1).getKey(), expectedPropertyKey); assertEquals(resultProperties.get(1).getValue(), expectedPropertyValue); }