### Question:
AbstractRdsConfigProvider { public Map<String, Object> createServicePillarConfigMapIfNeeded(Stack stack, Cluster cluster) { if (isRdsConfigNeeded(cluster.getBlueprint())) { Set<RDSConfig> rdsConfigs = createPostgresRdsConfigIfNeeded(stack, cluster); RDSConfig rdsConfig = rdsConfigs.stream().filter(rdsConfig1 -> rdsConfig1.getType().equalsIgnoreCase(getRdsType().name())).findFirst().get(); if (rdsConfig.getStatus() == ResourceStatus.DEFAULT && rdsConfig.getDatabaseEngine() != DatabaseVendor.EMBEDDED) { Map<String, Object> postgres = new HashMap<>(); if (dbServerConfigurer.isRemoteDatabaseNeeded(cluster)) { DatabaseServerV4Response dbServerResponse = dbServerConfigurer.getDatabaseServer(cluster.getDatabaseServerCrn()); postgres.put("remote_db_url", dbServerResponse.getHost()); postgres.put("remote_db_port", dbServerResponse.getPort()); postgres.put("remote_admin", secretService.getByResponse(dbServerResponse.getConnectionUserName())); postgres.put("remote_admin_pw", secretService.getByResponse(dbServerResponse.getConnectionPassword())); } String dbName = getDb(); postgres.put("database", dbName); postgres.put("user", dbUsernameConverterService.toDatabaseUsername(rdsConfig.getConnectionUserName())); postgres.put("password", rdsConfig.getConnectionPassword()); LOGGER.debug("RDS config added to pillar for name: {} databaseEngine: {}", dbName, rdsConfig.getDatabaseEngine()); return Collections.singletonMap(getPillarKey(), postgres); } } return Collections.emptyMap(); }  Map<String, Object> createServicePillarConfigMapIfNeeded(Stack stack, Cluster cluster); Set<RDSConfig> createPostgresRdsConfigIfNeeded(Stack stack, Cluster cluster);  }### Answer:
@Test public void createServicePillarForLocalRdsConfig() { when(rdsConfigService.createIfNotExists(any(), any(), any())).thenAnswer(i -> i.getArguments()[1]); Stack testStack = TestUtil.stack(); InstanceMetaData metaData = testStack.getGatewayInstanceMetadata().iterator().next(); metaData.setInstanceMetadataType(InstanceMetadataType.GATEWAY_PRIMARY); testStack.getGatewayInstanceMetadata().add(metaData); Cluster testCluster = TestUtil.cluster(); Map<String, Object> result = underTest.createServicePillarConfigMapIfNeeded(testStack, testCluster); Map<String, Object> postgresData = (Map<String, Object>) result.get("clouderamanager"); assertEquals("clouderamanager", postgresData.get("database")); assertNull(postgresData.get("remote_db_url")); assertNotNull(postgresData.get("password")); }