Complete the code to use the @ExtendWith annotation with MockitoExtension.
import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.junit.jupiter.MockitoExtension; @ExtendWith([1].class) public class MyTest { // test methods }
The @ExtendWith annotation is used to register extensions in JUnit 5. To enable Mockito support, you use MockitoExtension.class.
Complete the code to register multiple extensions using @ExtendWith.
@ExtendWith([1].class, AnotherExtension.class) public class MultiExtensionTest { // test methods }
You can register multiple extensions by listing them inside the @ExtendWith annotation. Here, MockitoExtension.class is one of them.
Fix the error in the @ExtendWith annotation usage.
@ExtendWith([1]) public class ErrorTest { // test methods }
The @ExtendWith annotation requires class literals, so you must use MockitoExtension.class. Omitting .class causes a syntax error.
Fill both blanks to correctly use @ExtendWith with two extensions.
@ExtendWith([1].class, [2].class) public class CombinedTest { // test methods }
You can register multiple extensions by listing their class literals separated by commas inside @ExtendWith. Here, MockitoExtension.class and SpringExtension.class are used.
Fill all three blanks to create a test class with @ExtendWith registering three extensions.
@ExtendWith([1].class, [2].class, [3].class) public class TripleExtensionTest { // test methods }
You can register multiple extensions by listing their class literals inside @ExtendWith. Here, JUnitExtension.class, SpringExtension.class, and TestExtension.class are used.