### Question:
MonitoringConfigService { public MonitoringConfigView createMonitoringConfig(MonitoringClusterType clusterType, MonitoringAuthConfig authConfig) { final MonitoringConfigView.Builder builder = new MonitoringConfigView.Builder(); boolean enabled = false; LOGGER.debug("Tyring to set monitoring configurations."); if (clusterType != null) { builder.withType(clusterType.value()); } if (MonitoringClusterType.CLOUDERA_MANAGER.equals(clusterType)) { LOGGER.debug("Setting up monitoring configurations for Cloudera Manager"); if (authConfig != null && authConfig.getPassword() != null && StringUtils.isNoneBlank(authConfig.getUsername(), new String(authConfig.getPassword()))) { enabled = true; builder .withCMUsername(authConfig.getUsername()) .withCMPassword(authConfig.getPassword()); LOGGER.debug("Monitoring for Cloudera Manager has been setup correctly."); } else { LOGGER.debug("Monitoring for Cloudera Manager has invalid authentication configs, Monitoring will be disabled."); } } return builder .withEnabled(enabled) .build(); }  MonitoringConfigView createMonitoringConfig(MonitoringClusterType clusterType,
            MonitoringAuthConfig authConfig);  }### Answer:
@Test public void testCreateMeteringConfigs() { MonitoringClusterType clusterType = MonitoringClusterType.CLOUDERA_MANAGER; MonitoringAuthConfig authConfig = new MonitoringAuthConfig("user", "pass".toCharArray()); MonitoringConfigView result = underTest.createMonitoringConfig(clusterType, authConfig); assertTrue(result.isEnabled()); }
@Test public void testCreateMeteringConfigsWithNulls() { MonitoringConfigView result = underTest.createMonitoringConfig(null, null); assertFalse(result.isEnabled()); }