@Test public void jdbcCompliant_exception() throws SQLException { Driver driver = new MockDriver() { @Override public boolean jdbcCompliant() { throw new NullPointerException(); } }; HiveDriver d = new HiveDriver(getMockUtil(getMockShimWithDriver(driver))); // should return false if there is an exception assertFalse(d.jdbcCompliant()); }
@Test public void jdbcCompliant() throws SQLException { final AtomicBoolean called = new AtomicBoolean(false); Driver driver = new MockDriver() { @Override public boolean jdbcCompliant() { called.set(true); return false; } }; HiveDriver d = new HiveDriver(getMockUtil(getMockShimWithDriver(driver))); d.jdbcCompliant(); assertTrue(called.get()); }