You're encountering this error because the method CriteriaBuilder.isFalse() expects a parameter of type Expression<Boolean>, but you're passing a mock of type Path<Object>. Although Path<Boolean> is a subtype of Expression<Boolean>, your mock is declared as Path<Object>, and that's why the compiler complains.