### Question:
AggregatingToolScanManager implements ToolScanManager { @PostConstruct public void init() { initClients(); Arrays.asList( SystemPreferences.DOCKER_SECURITY_TOOL_SCAN_ENABLED, SystemPreferences.DOCKER_SECURITY_TOOL_SCAN_ENABLED, SystemPreferences.DOCKER_SECURITY_TOOL_SCAN_CLAIR_ROOT_URL, SystemPreferences.DOCKER_SECURITY_TOOL_SCAN_CLAIR_CONNECT_TIMEOUT, SystemPreferences.DOCKER_SECURITY_TOOL_SCAN_CLAIR_READ_TIMEOUT, SystemPreferences.DOCKER_COMP_SCAN_ROOT_URL) .forEach(this::subscribePreference); }  @PostConstruct void init(); ToolVersionScanResult scanTool(Tool tool, String tag, Boolean rescan); ToolVersionScanResult scanTool(Long toolId, String tag, Boolean rescan); ToolExecutionCheckStatus checkTool(Tool tool, String tag); @Override ToolScanPolicy getPolicy(); static final String NOT_DETERMINED; }### Answer:
@Test public void testInit() { AggregatingToolScanManager toolScanManager = new AggregatingToolScanManager(); PreferenceManager preferenceManager = new PreferenceManager(); PreferenceDao preferenceDao = Mockito.mock(PreferenceDao.class); SystemPreferences systemPreferences = Mockito.mock(SystemPreferences.class); Whitebox.setInternalState(preferenceManager, "preferenceDao", preferenceDao); Whitebox.setInternalState(preferenceManager, "messageHelper", messageHelper); Whitebox.setInternalState(preferenceManager, "systemPreferences", systemPreferences); Whitebox.setInternalState(toolScanManager, "preferenceManager", preferenceManager); toolScanManager.init(); ClairService service = (ClairService) Whitebox.getInternalState(toolScanManager, "clairService"); Assert.assertNull(service); Preference toolScanEnabled = SystemPreferences.DOCKER_SECURITY_TOOL_SCAN_ENABLED.toPreference(); toolScanEnabled.setValue("true"); when(preferenceDao.loadPreferenceByName(toolScanEnabled.getName())).thenReturn(toolScanEnabled); Preference clairRootUrl = SystemPreferences.DOCKER_SECURITY_TOOL_SCAN_CLAIR_ROOT_URL.toPreference(); clairRootUrl.setValue("http: when(preferenceDao.loadPreferenceByName(clairRootUrl.getName())).thenReturn(clairRootUrl); preferenceManager.update(Arrays.asList(toolScanEnabled, clairRootUrl)); service = (ClairService) Whitebox.getInternalState(toolScanManager, "clairService"); Assert.assertNotNull(service); }