"unsatisfied dependency during test" Code Answer


you need to annotate the test with springboottest so that spring initialize an application context


public class addressservicetest {
// the remaining test

also you do not need mockitoannotations.initmocks(this);

spring takes care of the mock handling

when [@mockbean is]used on a field, the instance of the created mock will also be injected. mock beans are automatically reset after each test method

see mocking and spying beans

By 1077 on July 1 2022
Only authorized users can answer the Search term. Please sign in first, or register a free account.