Giriş
Bir sürü @MockBean yerine tek bir yerde tüm mock'ları tanımlamaya yarar. Açıklaması şöyle.
Elimizde şöyle bir kod olsun.
Bir sürü @MockBean yerine tek bir yerde tüm mock'ları tanımlamaya yarar. Açıklaması şöyle.
ÖrnekContainer annotation that aggregates several @MockBean annotations.
Elimizde şöyle bir kod olsun.
@ExtendWith(SpringExtension.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class EndpointsTest implements ApplicationContextAware {
    @MockBean
    ComponentA componentA;
    @MockBean
    ComponentB componentB;
...@Configuration
@MockBeans({YourComponentSuperclass.class})
public class TestConfig {
} 
Hiç yorum yok:
Yorum Gönder