@SuppressWarnings({ "rawtypes", "unchecked" }) @Test public void dynamic_when_config_has_option_set_expected_dynamic_setup_combination_is_returned() { AbstractMockedAdapter mockedCheckmarxAdapter = mock(AbstractMockedAdapter.class); AbstractAdapterConfig config = mock(AbstractAdapterConfig.class); when(mockedCheckmarxAdapter.createAdapterId()).thenReturn("MockedNessusAdapter"); Map<AdapterOptionKey, String> options = new HashMap<>(); options.put(AdapterOptionKey.MOCK_CONFIGURATION_RESULT, "yellow"); when(config.getOptions()).thenReturn(options); when(config.getTargetAsString()).thenReturn("target1"); when(mockedCheckmarxAdapter.getPathToMockResultFile("yellow")).thenReturn("pathFromAdapter"); MockedAdapterSetupEntry checkmarxSetup = serviceToTest.getSetupFor(mockedCheckmarxAdapter,config); assertNotNull(checkmarxSetup); MockedAdapterSetupCombination combination = checkmarxSetup.getCombination("target1"); assertNotNull(combination); assertEquals("target1",combination.getTarget()); assertEquals("Filepath differs","pathFromAdapter",combination.getFilePath()); assertFalse(combination.isThrowsAdapterException()); assertEquals(1000L, combination.getTimeToElapseInMilliseconds()); }
public <A extends AdapterContext<C>, C extends AdapterConfig> MockedAdapterSetupEntry getSetupFor(AbstractMockedAdapter<A, C> adapter, C config) { boolean configuredResult = config.getOptions().get(AdapterOptionKey.MOCK_CONFIGURATION_RESULT)!=null; if (configuredResult) { return createDynamicResultByAdapter(adapter,config); } return createStaticResultByTargets(adapter); }
MockedAdapterSetupService { public <A extends AdapterContext<C>, C extends AdapterConfig> MockedAdapterSetupEntry getSetupFor(AbstractMockedAdapter<A, C> adapter, C config) { boolean configuredResult = config.getOptions().get(AdapterOptionKey.MOCK_CONFIGURATION_RESULT)!=null; if (configuredResult) { return createDynamicResultByAdapter(adapter,config); } return createStaticResultByTargets(adapter); } }
MockedAdapterSetupService { public <A extends AdapterContext<C>, C extends AdapterConfig> MockedAdapterSetupEntry getSetupFor(AbstractMockedAdapter<A, C> adapter, C config) { boolean configuredResult = config.getOptions().get(AdapterOptionKey.MOCK_CONFIGURATION_RESULT)!=null; if (configuredResult) { return createDynamicResultByAdapter(adapter,config); } return createStaticResultByTargets(adapter); }  }
MockedAdapterSetupService { public <A extends AdapterContext<C>, C extends AdapterConfig> MockedAdapterSetupEntry getSetupFor(AbstractMockedAdapter<A, C> adapter, C config) { boolean configuredResult = config.getOptions().get(AdapterOptionKey.MOCK_CONFIGURATION_RESULT)!=null; if (configuredResult) { return createDynamicResultByAdapter(adapter,config); } return createStaticResultByTargets(adapter); }  MockedAdapterSetupEntry getSetupFor(AbstractMockedAdapter<A, C> adapter, C config); }
MockedAdapterSetupService { public <A extends AdapterContext<C>, C extends AdapterConfig> MockedAdapterSetupEntry getSetupFor(AbstractMockedAdapter<A, C> adapter, C config) { boolean configuredResult = config.getOptions().get(AdapterOptionKey.MOCK_CONFIGURATION_RESULT)!=null; if (configuredResult) { return createDynamicResultByAdapter(adapter,config); } return createStaticResultByTargets(adapter); }  MockedAdapterSetupEntry getSetupFor(AbstractMockedAdapter<A, C> adapter, C config); static final String DEFAULT_FILE_PATH; }