/** * Test marking of possibly broken status. * * @throws SecurityException * @throws NoSuchFieldException * @throws IllegalArgumentException * @throws IllegalAccessException */ @Test public void testMarkPossiblyBroken() throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { Field field = testClass.getClass().getDeclaredField("possiblyBroken"); field.setAccessible(true); field.set(testClass, false); testClass.markPossiblyBroken(null); Assert.assertTrue(field.getBoolean(testClass)); // Test that a db fatal error will lead to the pool being instructed to terminate all // connections (+ log) mockPool.terminateAllConnections(); mockLogger.error((String) anyObject(), anyObject()); replay(mockPool); testClass.markPossiblyBroken(new SQLException("test", "08001")); verify(mockPool); }