@Test
    void verifyConnectionValidity() throws Throwable {
        val ds = mock(CloseableDataSource.class);
        when(ds.getConnection()).thenThrow(new RuntimeException());
        assertFalse(JpaBeans.isValidDataSourceConnection(ds, 1));
    }
This is {@link JpaBeansTests}.

@author Misagh Moayyed
@since 6.4.0
support/cas-server-support-jpa-util/src/test/java/org/apereo/cas/configuration/support/JpaBeansTests.java