### Question:
AwsDataSourceResourceConverter extends GenericJdbcDataSourceResourceConverter<AwsReportDataSource, ClientAwsDataSource> { @Override protected AwsReportDataSource resourceSpecificFieldsToServer(ClientAwsDataSource clientObject, AwsReportDataSource resultToUpdate, List<Exception> exceptions, ToServerConversionOptions options) throws IllegalParameterValueException { final AwsReportDataSource awsReportDataSource = super.resourceSpecificFieldsToServer(clientObject, resultToUpdate, exceptions, options); awsReportDataSource.setRoleARN(clientObject.getRoleArn()); awsReportDataSource.setAWSAccessKey(clientObject.getAccessKey()); awsReportDataSource.setAWSRegion(clientObject.getRegion()); if (clientObject.getSecretKey() != null || clientObject.getAccessKey() == null) { awsReportDataSource.setAWSSecretKey(clientObject.getSecretKey()); } awsReportDataSource.setDbInstanceIdentifier(clientObject.getDbInstanceIdentifier()); awsReportDataSource.setDbName(clientObject.getDbName()); awsReportDataSource.setDbService(clientObject.getDbService()); return awsReportDataSource; }    }### Answer:
@Test public void resourceSpecificFieldsToServer() throws Exception { final String expectedAccessKey = "textAccessKey"; final String expectedSecretKey = "testSecretKey"; final String expectedRoleArn = "testRoleArn"; final String expectedRegion = "testRegion"; final String expectedDbName = "testDbName"; final String expectedDbInstanceIdentifier = "testDbInstanceIdentifier"; final String expectedDbService = "testDbService"; final String expectedDriverClass = "testDriverClass"; AwsReportDataSource serverObject = new AwsReportDataSourceImpl(); ClientAwsDataSource clientObject = new ClientAwsDataSource(); clientObject.setAccessKey(expectedAccessKey); clientObject.setDbInstanceIdentifier(expectedDbInstanceIdentifier); clientObject.setDbName(expectedDbName); clientObject.setDbService(expectedDbService); clientObject.setRegion(expectedRegion); clientObject.setRoleArn(expectedRoleArn); clientObject.setSecretKey(expectedSecretKey); clientObject.setDriverClass(expectedDriverClass); final AwsReportDataSource result = converter.resourceSpecificFieldsToServer(clientObject, serverObject, new ArrayList<Exception>(), null); assertSame(result, serverObject); assertEquals(result.getAWSSecretKey(), expectedSecretKey); assertEquals(result.getAWSAccessKey(), expectedAccessKey); assertEquals(result.getAWSRegion(), expectedRegion); assertEquals(result.getRoleARN(), expectedRoleArn); assertEquals(result.getDbInstanceIdentifier(), expectedDbInstanceIdentifier); assertEquals(result.getDbName(), expectedDbName); assertEquals(result.getDbService(), expectedDbService); assertEquals(result.getDriverClass(), expectedDriverClass); }
@Test public void resourceSpecificFieldsToServer_secretKeyChangedToValueInClientObjectIfAccessKeyNull(){ AwsReportDataSource serverObject = new AwsReportDataSourceImpl(); serverObject.setAWSSecretKey("Old Value"); ClientAwsDataSource clientObject = new ClientAwsDataSource(); final AwsReportDataSource result = converter.resourceSpecificFieldsToServer(clientObject, serverObject, new ArrayList<Exception>(), null); assertNull(result.getAWSSecretKey()); }