Add mock prepared statement to make test pass.

master
baztian 2015-04-03 14:37:25 +02:00
parent 56ad5c35f0
commit b3af11bd51
1 changed files with 5 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import java.sql.Connection;
import java.sql.Driver; import java.sql.Driver;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.DriverPropertyInfo; import java.sql.DriverPropertyInfo;
import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException; import java.sql.SQLFeatureNotSupportedException;
import java.util.Properties; import java.util.Properties;
@ -27,7 +28,10 @@ public class MockDriver implements Driver {
if (!acceptsURL(url)) { if (!acceptsURL(url)) {
return null; return null;
} }
return Mockito.mock(Connection.class); Connection mockConnection = Mockito.mock(Connection.class);
PreparedStatement mockPreparedStatement = Mockito.mock(PreparedStatement.class);
Mockito.when(mockConnection.prepareStatement(Mockito.anyString())).thenReturn(mockPreparedStatement);
return mockConnection;
} }
@Override @Override