### Question:
SecHubAdapterOptionsBuilderStrategy implements AdapterConfigurationStrategy { @Override public <B extends AbstractAdapterConfigBuilder<B, C>, C extends AdapterConfig> void configure(B configBuilder) { String mockDataResultLowerCased = fetchMockConfigurationResultLowerCased(); if (mockDataResultLowerCased!=null) { configBuilder. setOption(AdapterOptionKey.MOCK_CONFIGURATION_RESULT, mockDataResultLowerCased) ; } } SecHubAdapterOptionsBuilderStrategy(SecHubExecutionContext context, ScanType scanType); @Override void configure(B configBuilder);  }### Answer:
@SuppressWarnings("unchecked") @Test public void strategy_will_set_dediccated_mock_config_result_for_scantype_codescan() { SecHubAdapterOptionsBuilderStrategy strategyToTest = new SecHubAdapterOptionsBuilderStrategy(context, ScanType.CODE_SCAN); strategyToTest.configure(configBuilder); verify(configBuilder).setOption(AdapterOptionKey.MOCK_CONFIGURATION_RESULT, "red"); }
@SuppressWarnings("unchecked") @Test public void strategy_will_set_dediccated_mock_config_result_for_scantype_webscan() { SecHubAdapterOptionsBuilderStrategy strategyToTest = new SecHubAdapterOptionsBuilderStrategy(context, ScanType.WEB_SCAN); strategyToTest.configure(configBuilder); verify(configBuilder).setOption(AdapterOptionKey.MOCK_CONFIGURATION_RESULT, "yellow"); }
@SuppressWarnings("unchecked") @Test public void strategy_will_set_dediccated_mock_config_result_for_scantype_infrascan() { SecHubAdapterOptionsBuilderStrategy strategyToTest = new SecHubAdapterOptionsBuilderStrategy(context, ScanType.INFRA_SCAN); strategyToTest.configure(configBuilder); verify(configBuilder).setOption(AdapterOptionKey.MOCK_CONFIGURATION_RESULT, "green"); }
@SuppressWarnings("unchecked") @Test public void strategy_will_set_no_mock_config_result_for_type_code_scan_when_not_defined() { SecHubAdapterOptionsBuilderStrategy strategyToTest = new SecHubAdapterOptionsBuilderStrategy(context, ScanType.CODE_SCAN); scanProjectMockDataConfig.setCodeScan(null); strategyToTest.configure(configBuilder); verify(configBuilder, never()).setOption(eq(AdapterOptionKey.MOCK_CONFIGURATION_RESULT), any()); }
@SuppressWarnings("unchecked") @Test public void strategy_will_set_no_mock_config_result_for_type_web_scan_when_not_defined() { SecHubAdapterOptionsBuilderStrategy strategyToTest = new SecHubAdapterOptionsBuilderStrategy(context, ScanType.WEB_SCAN); scanProjectMockDataConfig.setWebScan(null); strategyToTest.configure(configBuilder); verify(configBuilder, never()).setOption(eq(AdapterOptionKey.MOCK_CONFIGURATION_RESULT), any()); }
@SuppressWarnings("unchecked") @Test public void strategy_will_set_no_mock_config_result_for_type_infra_scan_when_not_defined() { SecHubAdapterOptionsBuilderStrategy strategyToTest = new SecHubAdapterOptionsBuilderStrategy(context, ScanType.INFRA_SCAN); scanProjectMockDataConfig.setInfraScan(null); strategyToTest.configure(configBuilder); verify(configBuilder, never()).setOption(eq(AdapterOptionKey.MOCK_CONFIGURATION_RESULT), any()); }