MariaDBXAConnectionWrapper implements XAConnectionWrapper { @SneakyThrows({SQLException.class, ReflectiveOperationException.class}) @Override public XAConnection wrap(final XADataSource xaDataSource, final Connection connection) { MariaDbConnection physicalConnection = (MariaDbConnection) connection.unwrap(Class.forName("org.mariadb.jdbc.MariaDbConnection")); return new MariaXaConnection(physicalConnection); }  @SneakyThrows({SQLException.class, ReflectiveOperationException.class}) @Override XAConnection wrap(final XADataSource xaDataSource, final Connection connection);  }
@Test public void assertCreateMariaDBConnection() throws SQLException { XAConnection actual = new MariaDBXAConnectionWrapper().wrap(xaDataSource, connection); assertThat(actual.getXAResource(), instanceOf(XAResource.class)); assertThat(actual.getConnection(), instanceOf(Connection.class)); }