All Downloads are FREE. Search and download functionalities are using the official Maven repository.

test.junit.mock.sql.MockDriver Maven / Gradle / Ivy

Go to download

The Fedora Client is a Java Library that allows API access to a Fedora Repository. The client is typically one part of a full Fedora installation.

The newest version!

package mock.sql;

import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;

import java.util.Properties;

/**
 * A partial implementation of {@link Driver} for use in unit tests. Add more
 * mocking to this class as needed, or override methods in sub-classes.
 * 
 * @author Jim Blake
 */
public class MockDriver
        implements Driver {

    // ----------------------------------------------------------------------
    // Mocking infrastructure
    // ----------------------------------------------------------------------

    public static final String PROTOCOL = "mock";

    // ----------------------------------------------------------------------
    // Mocked methods
    // ----------------------------------------------------------------------

    public boolean acceptsURL(String url) throws SQLException {
        return url.startsWith(PROTOCOL + "://");
    }

    public Connection connect(String url, Properties info) throws SQLException {
        return new MockConnection();
    }

    // ----------------------------------------------------------------------
    // Un-implemented methods
    // ----------------------------------------------------------------------

    public int getMajorVersion() {
        throw new RuntimeException("MockDriver.getMajorVersion not implemented");
    }

    public int getMinorVersion() {
        throw new RuntimeException("MockDriver.getMinorVersion not implemented");
    }

    public DriverPropertyInfo[] getPropertyInfo(String arg0, Properties arg1)
            throws SQLException {
        throw new RuntimeException("MockDriver.getPropertyInfo not implemented");
    }

    public boolean jdbcCompliant() {
        throw new RuntimeException("MockDriver.jdbcCompliant not implemented");
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy