### Question:
DatabusConfigService { public DatabusConfigView createDatabusConfigs(String accessKeyId, char[] accessKeySecret, String secretAlgorithm, String endpoint) { final DatabusConfigView.Builder builder = new DatabusConfigView.Builder(); boolean validAccessKeySecret = accessKeySecret != null && StringUtils.isNotEmpty(new String(accessKeySecret)); boolean enableDbus = validAccessKeySecret && StringUtils.isNoneEmpty(endpoint, new String(accessKeySecret)); if (enableDbus) { builder.withEndpoint(endpoint) .withAccessKeyId(accessKeyId) .withAccessKeySecret(accessKeySecret) .withAccessKeySecretAlgorithm(secretAlgorithm); } else { LOGGER.debug("Although metering or cluster deployment log reporting is enabled, databus " + "credentials/endpoint is not provided properly. endpoint: {}, accessKey: {}, privateKey: {}", endpoint, accessKeyId, validAccessKeySecret ? "*****" : "<empty>"); } return builder .withEnabled(enableDbus) .build(); }  DatabusConfigView createDatabusConfigs(String accessKeyId,
            char[] accessKeySecret, String secretAlgorithm, String endpoint);  }### Answer:
@Test public void testCreateConfig() { DatabusConfigView result = underTest.createDatabusConfigs("accessKey", "secret".toCharArray(), null, "myEndpoint"); assertTrue(result.isEnabled()); assertEquals("accessKey", result.getAccessKeyId()); assertEquals("secret", new String(result.getAccessKeySecret())); assertEquals("myEndpoint", result.getEndpoint()); assertEquals("Ed25519", result.toMap().get("accessKeySecretAlgorithm")); }
@Test public void testCreateConfigWithAlgorithm() { DatabusConfigView result = underTest.createDatabusConfigs("accessKey", "secret".toCharArray(), "RSA", "myEndpoint"); assertTrue(result.isEnabled()); assertEquals("accessKey", result.getAccessKeyId()); assertEquals("secret", new String(result.getAccessKeySecret())); assertEquals("myEndpoint", result.getEndpoint()); assertEquals("RSA", result.toMap().get("accessKeySecretAlgorithm")); }
@Test public void testCreateConfigWithoutSecret() { DatabusConfigView result = underTest.createDatabusConfigs("accessKey", null, null, "myEndpoint"); assertFalse(result.isEnabled()); }
@Test public void testCreateConfigWithoutEndpoint() { DatabusConfigView result = underTest.createDatabusConfigs("accessKey", "secret".toCharArray(), null, null); assertFalse(result.isEnabled()); }