### Question:
JooqUnitOfWorkService implements UnitOfWorkService { @Override public void commit() { JooqUnitOfWork jooqUnitOfWork = getCurrentJooq(); try { CURRENT_UNIT_OF_WORK.remove(); jooqUnitOfWork.getConnection().commit(); jooqUnitOfWork.getConnection().close(); } catch (SQLException e) { throw new UnrecoverableException("Cannot commit transaction", e); } } JooqUnitOfWorkService(ManagedDataSource managedDataSource, JooqUnitOfWorkFactory jooqUnitOfWorkFactory); @Override UnitOfWork getCurrent(); @Override UnitOfWork start(); @Override void commit(); @Override void abort();  }### Answer:
@Test public void testCommit() throws Exception { Connection connection = mock(Connection.class); JooqUnitOfWork unitOfWork = mock(JooqUnitOfWork.class); when(unitOfWork.getConnection()).thenReturn(connection); when(jooqUnitOfWorkFactory.create(connection)).thenReturn(unitOfWork); when(managedDataSource.getConnection()).thenReturn(connection); sut.start(); sut.commit(); verify(connection).commit(); verify(connection).close(); }