### Question:
KnoxGatewayConfigProvider extends AbstractRoleConfigProvider { @Override public Map<String, ApiClusterTemplateService> getAdditionalServices(CmTemplateProcessor cmTemplateProcessor, TemplatePreparationObject source) { if (source.getGatewayView() != null && cmTemplateProcessor.getServiceByType(KnoxRoles.KNOX).isEmpty()) { ApiClusterTemplateService knox = createBaseKnoxService(); Set<HostgroupView> hostgroupViews = source.getHostgroupViews(); return hostgroupViews.stream() .filter(hg -> InstanceGroupType.GATEWAY.equals(hg.getInstanceGroupType())) .collect(Collectors.toMap(HostgroupView::getName, v -> knox)); } return Map.of(); }  @Override Map<String, ApiClusterTemplateService> getAdditionalServices(CmTemplateProcessor cmTemplateProcessor, TemplatePreparationObject source); @Override String getServiceType(); @Override List<String> getRoleTypes();  }### Answer:
@Test public void testGetAdditionalServicesWhenNoKnoxRequested() { HostgroupView master = new HostgroupView("master", 1, InstanceGroupType.GATEWAY, 1); HostgroupView worker = new HostgroupView("worker", 2, InstanceGroupType.CORE, 2); TemplatePreparationObject preparationObject = Builder.builder().withHostgroupViews(Set.of(master, worker)).build(); String inputJson = getBlueprintText("input/clouderamanager.bp"); CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson); Map<String, ApiClusterTemplateService> additionalServices = underTest.getAdditionalServices(cmTemplateProcessor, preparationObject); assertTrue(additionalServices.isEmpty()); }
@Test public void testGetAdditionalServicesWhenKnoxRequestedAndBlueprintContainsIt() { HostgroupView master = new HostgroupView("master", 1, InstanceGroupType.GATEWAY, 1); HostgroupView worker = new HostgroupView("worker", 2, InstanceGroupType.CORE, 2); Gateway gateway = new Gateway(); TemplatePreparationObject preparationObject = Builder.builder() .withHostgroupViews(Set.of(master, worker)) .withGateway(gateway, "key", new HashSet<>()) .build(); String inputJson = getBlueprintText("input/clouderamanager-knox.bp"); CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson); Map<String, ApiClusterTemplateService> additionalServices = underTest.getAdditionalServices(cmTemplateProcessor, preparationObject); assertTrue(additionalServices.isEmpty()); }