This test class can be described as follows:
@ExtendWith(MockitoExtension.class): Mockito’s JUnit 5 hook to mock out any fields with the @Mock annotation
VideoService: The class under test
VideoRepository: A collaborator required for VideoService is marked for mocking
@BeforeEach: JUnit 5’s annotation to make this setup method run before every test method
The setUp() method shows VideoService being created with the mock VideoRepository injected through its constructor
xxxxxxxxxx
@ExtendWith(MockitoExtension.class)
public class VideoServiceTest {
VideoService service;
@Mock VideoRepository repository;
@BeforeEach
void setUp() {
this.service = new VideoService(repository);
}
}