MockDriver: Add compatability to recent java version.
parent
54f83919e4
commit
01b1eea67d
|
|
@ -5,53 +5,59 @@ import java.sql.Driver;
|
|||
import java.sql.DriverManager;
|
||||
import java.sql.DriverPropertyInfo;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.SQLFeatureNotSupportedException;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.mockito.Mockito;
|
||||
|
||||
public class MockDriver implements Driver {
|
||||
|
||||
static {
|
||||
MockDriver driver = new MockDriver();
|
||||
try {
|
||||
DriverManager.registerDriver(driver);
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
static {
|
||||
MockDriver driver = new MockDriver();
|
||||
try {
|
||||
DriverManager.registerDriver(driver);
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection connect(String url, Properties info) throws SQLException {
|
||||
if (!url.startsWith("jdbc:jaydebeapi://")) {
|
||||
return null;
|
||||
}
|
||||
return Mockito.mock(Connection.class);
|
||||
}
|
||||
@Override
|
||||
public Connection connect(String url, Properties info) throws SQLException {
|
||||
if (!url.startsWith("jdbc:jaydebeapi://")) {
|
||||
return null;
|
||||
}
|
||||
return Mockito.mock(Connection.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptsURL(String url) throws SQLException {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean acceptsURL(String url) throws SQLException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
|
||||
throws SQLException {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
|
||||
throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMajorVersion() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int getMajorVersion() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinorVersion() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int getMinorVersion() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean jdbcCompliant() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean jdbcCompliant() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported by this driver.");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue