I have a problem, because I have no idea how to properly test map of @Component.
I mean i have a strategy pattern (implements of interface, which are components) . In Service i have a map of these.
Im using mockito, and i dont know, should i Mock this map or add elements to this in @BeforeEach.
For example:
@Component
@RequiredArgsConstructor
public class Service {
private final Map<String, Strategy> strategies;
Test:
@ExtendWith(MockitoExtension.class)
public class ServiceTest {
@Mock
private Map<String, Strategy> strategies;
private Service service;
@BeforeEach
public void init() {
service = new Service(strategies);
}