I am using spring boot with jpa and spock. I want to assert that certain calls were made to the repo as a functional test, so a Mock won't do (I need to verify that a native query works with certain test data in the DB).
I have tried a @SpringBootTest
with:
@SpringSpy
MyJpaRepository repo
interaction {
1 * repo.someMethod(_)
}
where MyJpaRepository extends JpaRepository<Foo, Long>
, but when I run the test I get:
Cannot create mock for class com.sun.proxy.$Proxynnn because Java mocks cannot mock final classes. If the code under test is written in Groovy, use a Groovy mock.
Other than this error, all my functional tests work, so it's not a config issue.
How can I spy on an @Autowired
bean?
Aucun commentaire:
Enregistrer un commentaire