### Question:
HiveKnoxConfigProvider implements CmTemplateComponentConfigProvider { @Override public boolean isConfigurationNeeded(CmTemplateProcessor cmTemplateProcessor, TemplatePreparationObject source) { return cmTemplateProcessor.isRoleTypePresentInService(getServiceType(), getRoleTypes()) && source.getKerberosConfig().isPresent(); }  @Override List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject templatePreparationObject); @Override String getServiceType(); @Override List<String> getRoleTypes(); @Override boolean isConfigurationNeeded(CmTemplateProcessor cmTemplateProcessor, TemplatePreparationObject source);  }### Answer:
@Test void isConfigurationNeeded() { when(cmTemplateProcessor.isRoleTypePresentInService(anyString(), anyList())).thenReturn(true); TemplatePreparationObject tpo = Builder.builder() .withKerberosConfig(KerberosConfig.KerberosConfigBuilder.aKerberosConfig().build()) .build(); assertThat(underTest.isConfigurationNeeded(cmTemplateProcessor, tpo)).isTrue(); }
@Test void isConfigurationNotNeededWithRoleTypeNotPresent() { when(cmTemplateProcessor.isRoleTypePresentInService(anyString(), anyList())).thenReturn(false); TemplatePreparationObject tpo = Builder.builder() .withKerberosConfig(KerberosConfig.KerberosConfigBuilder.aKerberosConfig().build()) .build(); assertThat(underTest.isConfigurationNeeded(cmTemplateProcessor, tpo)).isFalse(); }
@Test void isConfigurationNotNeededWithRoleTypePresent() { lenient().when(cmTemplateProcessor.isRoleTypePresentInService(anyString(), anyList())).thenReturn(true); TemplatePreparationObject tpo = Builder.builder() .build(); assertThat(underTest.isConfigurationNeeded(cmTemplateProcessor, tpo)).isFalse(); }