RouterProcessor extends ProcessorBase { @Override public void process(final WilmaHttpEntity entity) throws ApplicationException { WilmaHttpRequest request = (WilmaHttpRequest) entity; boolean bypassWilma = isByPassPresentInHeader(request.getHeaders()); if (!bypassWilma && !request.isRerouted()) { router.reroute(request); } }  @Override void process(final WilmaHttpEntity entity);  }
@Test public void testProcessShouldCallRouter() throws ApplicationException { Map<String, String> headers = new HashMap<>(); headers.put("1", "1"); given(request.getHeaders()).willReturn(headers); underTest.process(request); verify(router).reroute(request); }
@Test public void testProcessShouldWhenByPassExistsInHeaderNameShouldNotRedirectRequest() throws ApplicationException { Map<String, String> headers = new HashMap<>(); headers.put(BYPASS_VALUE, ""); given(request.getHeaders()).willReturn(headers); underTest.process(request); verify(router, never()).reroute(request); }
@Test public void testProcessShouldWhenByPassExistsInHeaderValueShouldNotRedirectRequest() throws ApplicationException { Map<String, String> headers = new HashMap<>(); headers.put("1", BYPASS_VALUE); given(request.getHeaders()).willReturn(headers); underTest.process(request); verify(router, never()).reroute(request); }
@Test public void testProcessShouldWhenByPassExistsInHeaderNameAndValueShouldNotRedirectRequest() throws ApplicationException { Map<String, String> headers = new HashMap<>(); headers.put("1", "1"); headers.put(BYPASS_VALUE, BYPASS_VALUE); given(request.getHeaders()).willReturn(headers); underTest.process(request); verify(router, never()).reroute(request); }