AndGeneralChecker implements ConditionChecker { @Override public boolean checkCondition(final WilmaHttpRequest request, final ParameterList parameterMap) { return headerChecker.checkCondition(request, parameterMap) || bodyChecker.checkCondition(request, parameterMap) || urlChecker.checkCondition(request, parameterMap); } AndGeneralChecker(final ConditionChecker headerChecker, final ConditionChecker bodyChecker, final ConditionChecker urlChecker); @Override boolean checkCondition(final WilmaHttpRequest request, final ParameterList parameterMap);  }
@Test public void testCheckConditionShouldCallHeaderAndBodyPatternCheckersAndReturnWithTrue() { BDDMockito.given(headerChecker.checkCondition(request, parameterMap)).willReturn(true); BDDMockito.given(bodyChecker.checkCondition(request, parameterMap)).willReturn(true); BDDMockito.given(urlChecker.checkCondition(request, parameterMap)).willReturn(true); boolean actual = underTest.checkCondition(request, parameterMap); assertTrue(actual); }
@Test public void testCheckConditionShouldCallHeaderAndBodyPatternCheckersAndReturnWithTrueWhenPatternNotInHeader() { BDDMockito.given(headerChecker.checkCondition(request, parameterMap)).willReturn(false); BDDMockito.given(bodyChecker.checkCondition(request, parameterMap)).willReturn(true); BDDMockito.given(urlChecker.checkCondition(request, parameterMap)).willReturn(false); boolean actual = underTest.checkCondition(request, parameterMap); assertTrue(actual); }
@Test public void testCheckConditionShouldCallHeaderAndBodyPatternCheckersAndReturnWithTrueWhenPatternNotInBody() { BDDMockito.given(headerChecker.checkCondition(request, parameterMap)).willReturn(true); BDDMockito.given(bodyChecker.checkCondition(request, parameterMap)).willReturn(false); BDDMockito.given(urlChecker.checkCondition(request, parameterMap)).willReturn(false); boolean actual = underTest.checkCondition(request, parameterMap); assertTrue(actual); }
@Test public void testCheckConditionShouldCallHeaderAndBodyPatternCheckersAndReturnWithFalse() { BDDMockito.given(headerChecker.checkCondition(request, parameterMap)).willReturn(false); BDDMockito.given(bodyChecker.checkCondition(request, parameterMap)).willReturn(false); BDDMockito.given(urlChecker.checkCondition(request, parameterMap)).willReturn(false); boolean actual = underTest.checkCondition(request, parameterMap); assertFalse(actual); }
@Test public void testCheckConditionShouldCallUrlPatternCheckerAndReturnWithTrue() { BDDMockito.given(headerChecker.checkCondition(request, parameterMap)).willReturn(false); BDDMockito.given(bodyChecker.checkCondition(request, parameterMap)).willReturn(false); BDDMockito.given(urlChecker.checkCondition(request, parameterMap)).willReturn(true); boolean actual = underTest.checkCondition(request, parameterMap); assertTrue(actual); }