### Question:
KernelTransactions extends LifecycleAdapter implements Supplier<KernelTransactionsSnapshot> { public Set<KernelTransactionHandle> activeTransactions() { return allTransactions .stream() .map( this::createHandle ) .filter( KernelTransactionHandle::isOpen ) .collect( toSet() ); } KernelTransactions( Config config, StatementLocksFactory statementLocksFactory, ConstraintIndexCreator constraintIndexCreator,
            StatementOperationParts statementOperations, SchemaWriteGuard schemaWriteGuard, TransactionHeaderInformationFactory txHeaderFactory,
            TransactionCommitProcess transactionCommitProcess, AuxiliaryTransactionStateManager auxTxStateManager, TransactionHooks hooks,
            TransactionMonitor transactionMonitor, AvailabilityGuard databaseAvailabilityGuard, Tracers tracers, StorageEngine storageEngine,
            Procedures procedures, TransactionIdStore transactionIdStore, SystemNanoClock clock, AtomicReference<CpuClock> cpuClockRef,
            AtomicReference<HeapAllocation> heapAllocationRef, AccessCapability accessCapability, AutoIndexing autoIndexing,
            ExplicitIndexStore explicitIndexStore, VersionContextSupplier versionContextSupplier, CollectionsFactorySupplier collectionsFactorySupplier,
            ConstraintSemantics constraintSemantics, SchemaState schemaState, IndexingService indexingService, TokenHolders tokenHolders,
            String currentDatabaseName, Dependencies dataSourceDependencies ); KernelTransaction newInstance( KernelTransaction.Type type, LoginContext loginContext, long timeout ); Set<KernelTransactionHandle> activeTransactions(); void disposeAll(); void terminateTransactions(); boolean haveClosingTransaction(); @Override void start(); @Override void stop(); @Override void shutdown(); @Override KernelTransactionsSnapshot get(); void blockNewTransactions(); void unblockNewTransactions();  }### Answer:
@Test public void shouldListActiveTransactions() throws Throwable { KernelTransactions transactions = newTestKernelTransactions(); KernelTransaction first = getKernelTransaction( transactions ); KernelTransaction second = getKernelTransaction( transactions ); KernelTransaction third = getKernelTransaction( transactions ); first.close(); assertThat( transactions.activeTransactions(), equalTo( asSet( newHandle( second ), newHandle( third ) ) ) ); }
@Test public void transactionCloseRemovesTxFromActiveTransactions() throws Throwable { KernelTransactions kernelTransactions = newTestKernelTransactions(); KernelTransaction tx1 = getKernelTransaction( kernelTransactions ); KernelTransaction tx2 = getKernelTransaction( kernelTransactions ); KernelTransaction tx3 = getKernelTransaction( kernelTransactions ); tx1.close(); tx3.close(); assertEquals( asSet( newHandle( tx2 ) ), kernelTransactions.activeTransactions() ); }