CookieModifier implements CollectorJob { @Override public void setParameters(Map<String, String> params) throws ParametersException { modifyAction = ModifyAction.fromString(params.get(ACTION_PARAMETER)); name = params.get(NAME_PARAMETER); value = params.get(VALUE_PARAMETER); domain = params.get(DOMAIN_PARAMETER); path = params.get(PATH_PARAMETER); Validator validator = new CookieModifierValidator(name, value, modifyAction); validator.validate(validationResultBuilder); if (validationResultBuilder.hasErrors()) { throw new ParametersException(validationResultBuilder.toString()); } } CookieModifier(CollectorProperties properties, WebCommunicationWrapper webCommunicationWrapper,
      ValidationResultBuilder validationResultBuilder); @Override CollectorStepResult collect(); @Override void setParameters(Map<String, String> params); static final String NAME; }
@Test public void setParametersTest() throws ParametersException { when(validationResultBuilder.hasErrors()).thenReturn(false); tested.setParameters(params); }
@Test(expected = ParametersException.class) public void setParametersTest_invalid() throws ParametersException { when(validationResultBuilder.hasErrors()).thenReturn(true); tested.setParameters(params); }