Mocking2 Spring boot @MockBean @MockBean - includes Mockito @Mock functionality - also adds mock bean to if existing bean is there, the mock bean will replace it - thus making the mock bean available for injection with @Autowired Using @Mock @SpringBootTest class StudentRepositoryTest { @Mock private StudentRepository studentRepository; @InjectMocks private StudentService studentService; } Using @MockBean @SpringBootTest clas.. 2022. 5. 22. Java Conditional Unit Test @Test @Disabled("Don't run until JIRA #123 is resolved") void testDisabled(){ // } @Test @EnabledOnOs(OS.WINDOWS) void testForWindowsOnly(){ } @Test @EnabledOnOs(OS.MAC) void testForMacOnly(){ } @Test @EnabledOnOs({OS.MAC,OS.WINDOWS}) void testForMacAndWindowsOnly(){ } @Test @EnabledOnOs(OS.LINUX) void testForLinuxOnly(){ } @Test @EnabledOnJre(JRE.JAVA_17) void testForJava17(){ } @Test @EnabledO.. 2022. 5. 21. 이전 1 다음