ReplaceTextModifier extends WebElementsLocatorParams implements CollectorJob { @Override public void setParameters(Map<String, String> params) throws ParametersException { setElementParams(params); attributeName = StringUtils.defaultIfBlank(params.get(ATTRIBUTE_PARAM), "innerHTML"); value = StringUtils.defaultIfBlank(params.get(VALUE_PARAM), ""); } ReplaceTextModifier(WebDriver webDriver, CollectorProperties properties,
      JavaScriptJobExecutor jsExecutor); @Override CollectorStepResult collect(); @Override void setParameters(Map<String, String> params); static final String NAME; }
@Test public void setParameters_XPathIsValid_ValidationPassedSuccessfuly() throws ParametersException { when(params.containsKey(PARAM_XPATH)).thenReturn(true); when(params.get(PARAM_XPATH)).thenReturn(PARAM_XPATH_VALUE); tested.setParameters(params); }
@Test public void setParameters_CssIsValid_ValidationPassedSuccessfuly() throws ParametersException { when(params.containsKey(PARAM_CSS)).thenReturn(true); when(params.get(PARAM_CSS)).thenReturn(PARAM_CSS_VALUE); tested.setParameters(params); }
@Test(expected = ParametersException.class) public void setParameters_CssAndXpathArePassed_ExceptionIsThrown() throws ParametersException { when(params.containsKey(PARAM_CSS)).thenReturn(true); when(params.get(PARAM_CSS)).thenReturn(PARAM_CSS_VALUE); when(params.containsKey(PARAM_XPATH)).thenReturn(true); when(params.get(PARAM_XPATH)).thenReturn(PARAM_XPATH_VALUE); tested.setParameters(params); }
@Test(expected = ParametersException.class) public void setParameters_CssAndXpathAreNotPassed_ExceptionIsThrown() throws ParametersException { tested.setParameters(params); }
@Test(expected = ParametersException.class) public void setParameters_XPathIsInvalid_ExceptionIsThrown() throws ParametersException { tested.setParameters(params); }