public HandyReturnValues reportMatcher(Matcher matcher) { matcherStack.push(new LocalizedMatcher(matcher)); return new HandyReturnValues(); }
public Object handle(Invocation invocation) throws Throwable { Object result = delegate.handle(invocation); Class<?> returnType = invocation.getMethod().getReturnType(); if(result == null && returnType.isPrimitive()) { //primitive values cannot be null return new HandyReturnValues().returnFor(returnType); } else { return result; } }
public HandyReturnValues reportNot() { assertStateFor("Not(?)", ONE_SUB_MATCHER); Not not = new Not(popLastArgumentMatchers(ONE_SUB_MATCHER).get(0)); matcherStack.push(new LocalizedMatcher(not)); return new HandyReturnValues(); }
public HandyReturnValues reportOr() { assertStateFor("Or(?)", TWO_SUB_MATCHERS); Or or = new Or(popLastArgumentMatchers(TWO_SUB_MATCHERS)); matcherStack.push(new LocalizedMatcher(or)); return new HandyReturnValues(); }
public HandyReturnValues reportAnd() { assertStateFor("And(?)", TWO_SUB_MATCHERS); And and = new And(popLastArgumentMatchers(TWO_SUB_MATCHERS)); matcherStack.push(new LocalizedMatcher(and)); return new HandyReturnValues(); }
public HandyReturnValues reportMatcher(Matcher matcher) { matcherStack.push(new LocalizedMatcher(matcher)); return new HandyReturnValues(); }
public HandyReturnValues reportNot() { assertState(!matcherStack.isEmpty(), "No matchers found for Not(?)."); Not not = new Not(popLastArgumentMatchers(1).get(0)); matcherStack.push(new LocalizedMatcher(not)); return new HandyReturnValues(); }
public HandyReturnValues reportAnd() { assertState(!matcherStack.isEmpty(), "No matchers found for And(?)."); And and = new And(popLastArgumentMatchers(2)); matcherStack.push(new LocalizedMatcher(and)); return new HandyReturnValues(); }
public HandyReturnValues reportOr() { assertState(!matcherStack.isEmpty(), "No matchers found."); Or or = new Or(popLastArgumentMatchers(2)); matcherStack.push(new LocalizedMatcher(or)); return new HandyReturnValues(); }