What is the difference between SpringJUnit4ClassRunner and SpringRunner

SpringRunner is an alias for the SpringJUnit4ClassRunner. @RunWith(SpringRunner.class) tells JUnit to run using Spring’s testing support. SpringRunner is the new name for SpringJUnit4ClassRunner, it’s just a bit easier on the eye. SpringRunner is only available after spring-test 4.3. SpringRunner class extends SpringJUnit4ClassRunner.   Read the doc source code Read more

Mybatis Dynamic SQL

1. If <select id="findActiveBlogWithTitleLike" resultType="Blog"> SELECT * FROM BLOG WHERE state = ‘ACTIVE’ <if test="title != null"> AND title like #{title} </if> </select> 2. Choose, When, Otherwise <select id="findActiveBlogLike" resultType="Blog"> SELECT * FROM BLOG WHERE state = ‘ACTIVE’ <choose> # Read more

A Template of JUnit5 with Mockito

@ExtendWith(MockitoExtension.class) class ArticleManagerTest { @Mock ArticleDatabase database; @Mock User user; @Spy @InjectMocks private ArticleManager manager; @BeforeEach void setup(){ // some initialization codes } @Test void shouldDoSomething() { // TODO perform some tests with this managers when(database.some(param)).thenReturn(data); Object res = manager.exe(); Read more