@Test
void testCreateSubsegmentWhenConnectionThrowsException() throws SQLException {

    when(connection.getMetaData()).thenThrow(new SQLException());
    Subsegment sub = SqlSubsegments.forQuery(connection, SQL);
    assertThat(AWSXRay.getCurrentSubsegment()).isEqualTo(sub);
    assertThat(sub.getName()).isEqualTo(SqlSubsegments.DEFAULT_DATABASE_NAME);
    assertThat(sub.isInProgress()).isTrue();
    assertThat(sub.getParentSegment().getSubsegments()).contains(sub);
}