public MethodCallTester<MonitoredClass> assertMethodNotCalled( String name, Class<?>... paramTypes) { assertFalse( "Method " + mockClass.getSimpleName() + "." + name + "(" + Arrays.toString(paramTypes) + ") was called but no call was expected", wasMethodCalled(name, paramTypes)); return this; }
public MethodCallTester<MonitoredClass> assertMethodCalled( String name, Object... expectedParamValues) { assertTrue( "Method " + mockClass.getSimpleName() + "." + name + "(" + Arrays.toString(expectedParamValues) + ") was not called", wasMethodCalled(name, expectedParamValues)); return this; }
@SuppressWarnings("unused") public MethodCallTester<MonitoredClass> assertMethodNotCalled( String name, Object... expectedParamValues) { assertFalse( "Method " + mockClass.getSimpleName() + "." + name + "(" + Arrays.toString(expectedParamValues) + ") was called but no call was expected", wasMethodCalled(name, expectedParamValues)); return this; }
/** * Check that all methods declared in the given interface were called. Does *not* include * methods from super interfaces. * * @return this for fluent api */ public MethodCallTester<MonitoredClass> assertAllInterfaceMethodsCalled() { List<MethodInvocation> currentInvocation = new ArrayList<>(invocations); // Debugger calling toString can mess with this for (Method method : mockClass.getDeclaredMethods()) { if (Modifier.isStatic(method.getModifiers()) || !Modifier.isPublic(method.getModifiers())) continue; boolean called = false; for (MethodInvocation invocation : currentInvocation) { if (invocation.method.equals(method.getName())) { called = true; break; } } assertTrue( "Method " + mockClass.getSimpleName() + "." + method.getName() + " was not called", called); } return this; }