HeaderModifier implements CollectorJob { @Override public CollectorStepResult collect() throws ProcessingException { if (!webCommunicationWrapper.isUseProxy()) { throw new ProcessingException("Cannot modify header without using proxy"); } webCommunicationWrapper.getProxyServer().addHeader(key, value, override); webCommunicationWrapper.getHttpRequestExecutor().addHeader(key, value); return CollectorStepResult.newModifierResult(); } HeaderModifier(WebCommunicationWrapper webCommunicationWrapper); @Override CollectorStepResult collect(); @Override void setParameters(Map<String, String> params); static final String NAME; }
@Test public void testCollect() throws Exception { headerModifier.setParameters(ImmutableMap.of("key", "header", "value", "value1")); headerModifier.collect(); verify(proxyServer).addHeader("header", "value1", false); verify(requestExecutor).addHeader("header", "value1"); }