Computer scienceBackendSpring BootSpring Testing

Testing Beans

Application

Report a typo

You have 3 components: Component1 depends on Component2 and Component2 depends on Component3. The purpose is to test a Component1, while Component3 is a mock.

Complete the test class:

@SpringBootTest
public class Component1Test {

    @MockBean
    private // 1

    @Autowired
    private // 2

    @Test
    void shouldDoSomething() {
        // test cases
    }
}
Match the items from left and right columns
// 1
// 2
doesn't participate in the test class
Component2 component2;
Component3 component3;
Component1 component1;

Create a free account to access the full topic