### Question:
GeogigTransaction extends DelegatingContext implements Context { public UUID getTransactionId() { return transactionId; } GeogigTransaction(Context context, UUID transactionId); static String buildTransactionNamespace(final UUID transactionId); void create(); void close(); GeogigTransaction setAuthor(@Nullable String authorName, @Nullable String authorEmail); UUID getTransactionId(); @Override WorkingTree workingTree(); @Override StagingArea stagingArea(); @Override RefDatabase refDatabase(); @Override String toString(); void commit(); void commit(ProgressListener listener); void commitSyncTransaction(); void commitSyncTransaction(ProgressListener listener); void abort(); @Override ConflictsDatabase conflictsDatabase(); @Override BlobStore blobStore(); List<RefChange> changedRefs(); @Override Context snapshot();  }### Answer:
@Test public void testResolveTransaction() throws Exception { GeogigTransaction tx = repo.command(TransactionBegin.class).call(); Optional<GeogigTransaction> txNew = repo.command(TransactionResolve.class) .setId(tx.getTransactionId()).call(); assertTrue(txNew.isPresent()); }
@Test public void testEndTransactionConflict() throws Exception { insertAndAdd(points1); RevCommit mainCommit = repo.command(CommitOp.class).setMessage("Commit1").call(); GeogigTransaction transaction = repo.command(TransactionBegin.class).call(); insertAndAdd(transaction, points1_modified); RevCommit transactionCommit = transaction.command(CommitOp.class).setMessage("Commit2") .call(); Iterator<RevCommit> logs = repo.command(LogOp.class).call(); assertEquals(mainCommit, logs.next()); assertFalse(logs.hasNext()); logs = transaction.command(LogOp.class).call(); assertEquals(transactionCommit, logs.next()); assertEquals(mainCommit, logs.next()); assertFalse(logs.hasNext()); deleteAndAdd(points1); RevCommit mainCommit2 = repo.command(CommitOp.class).setMessage("Commit3").call(); try { repo.command(TransactionEnd.class).setTransaction(transaction).call(); fail("Expected a conflict!"); } catch (ConflictsException e) { } long txConflicts = transaction.command(ConflictsCountOp.class).call().longValue(); long baseConflicts = repo.command(ConflictsCountOp.class).call().longValue(); assertTrue("There should be no conflicts outside the transaction", baseConflicts == 0); assertTrue("There should be conflicts in the transaction", txConflicts == 1); Optional<GeogigTransaction> resolvedTransaction = repo.command(TransactionResolve.class) .setId(transaction.getTransactionId()).call(); assertTrue(resolvedTransaction.isPresent()); deleteAndAdd(transaction, points1); RevCommit resolvedCommit = transaction.command(CommitOp.class) .setMessage("Resolved Conflict").call(); repo.command(TransactionEnd.class).setTransaction(transaction).call(); logs = repo.command(LogOp.class).call(); RevCommit lastCommit = logs.next(); assertEquals(resolvedCommit, lastCommit); assertEquals(mainCommit2, logs.next()); assertEquals(transactionCommit, logs.next()); assertEquals(mainCommit, logs.next()); }
@Test public void testEndTransactionFromTransactionId() throws Exception { GeogigTransaction tx = repo.command(TransactionBegin.class).call(); Optional<GeogigTransaction> txNew = repo.command(TransactionResolve.class) .setId(tx.getTransactionId()).call(); assertTrue(txNew.isPresent()); TransactionEnd endTransaction = repo.command(TransactionEnd.class); endTransaction.setCancel(false).setTransaction(txNew.get()).call(); }