@Test public void getMinorVersion_exception() { Driver driver = new MockDriver() { @Override public int getMinorVersion() { throw new NullPointerException(); } }; HiveDriver d = new HiveDriver(getMockUtil(getMockShimWithDriver(driver))); // If an exception is thrown the version returned should be -1 assertEquals(-1, d.getMinorVersion()); }
@Test public void getMinorVersion() throws SQLException { final AtomicBoolean called = new AtomicBoolean(false); Driver driver = new MockDriver() { @Override public int getMinorVersion() { called.set(true); return 0; } }; HiveDriver d = new HiveDriver(getMockUtil(getMockShimWithDriver(driver))); d.getMinorVersion(); assertTrue(called.get()); }