CachedDatabaseMetaData { private boolean isGeneratedKeyAlwaysReturned(final DatabaseMetaData databaseMetaData) throws SQLException { try { return databaseMetaData.generatedKeyAlwaysReturned(); } catch (final AbstractMethodError ignored) { return false; } } CachedDatabaseMetaData(final DatabaseMetaData databaseMetaData);   }
@Test public void assertIsGeneratedKeyAlwaysReturned() throws SQLException { when(databaseMetaData.generatedKeyAlwaysReturned()).thenReturn(true); assertTrue(new CachedDatabaseMetaData(databaseMetaData).isGeneratedKeyAlwaysReturned()); }
@Test public void assertIsGeneratedKeyAlwaysReturnedWhenNotSupported() throws SQLException { when(databaseMetaData.generatedKeyAlwaysReturned()).thenThrow(AbstractMethodError.class); assertFalse(new CachedDatabaseMetaData(databaseMetaData).isGeneratedKeyAlwaysReturned()); }