Clean up Mockito usage
This commit migrates to the MockitoJUnitRunner where sensible, which will later allow for an easier migration to Mockito's extension for JUnit Jupiter. In addition, this commit deletes unnecessary stubbing for various mocks and polishes test fixture setup in various test classes.
This commit is contained in:
@@ -25,9 +25,11 @@ import java.sql.Types;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
import org.springframework.jdbc.support.lob.LobCreator;
|
||||
import org.springframework.jdbc.support.lob.LobHandler;
|
||||
@@ -36,11 +38,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
/**
|
||||
* Test cases for the sql lob value:
|
||||
* Test cases for the SQL LOB value:
|
||||
*
|
||||
* BLOB:
|
||||
* 1. Types.BLOB: setBlobAsBytes (byte[])
|
||||
@@ -55,10 +56,16 @@ import static org.mockito.Mockito.verify;
|
||||
*
|
||||
* @author Alef Arendsen
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class SqlLobValueTests {
|
||||
|
||||
@Mock
|
||||
private PreparedStatement preparedStatement;
|
||||
|
||||
@Mock
|
||||
private LobHandler handler;
|
||||
|
||||
@Mock
|
||||
private LobCreator creator;
|
||||
|
||||
@Captor
|
||||
@@ -66,10 +73,6 @@ public class SqlLobValueTests {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
preparedStatement = mock(PreparedStatement.class);
|
||||
handler = mock(LobHandler.class);
|
||||
creator = mock(LobCreator.class);
|
||||
given(handler.getLobCreator()).willReturn(creator);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user