### Question:
LocalTransactionContext { Savepoint releaseAndGetSavepoint(String savepointName) { assertNotNull(savepointName); Savepoint result = savepointMap.get(savepointName); if (result == null) { return null; } int pos = savepointNames.lastIndexOf(savepointName); if (pos > -1) { List<String> subList = savepointNames.subList(pos, savepointNames.size()); for (String name : subList) { savepointMap.remove(name); } subList.clear(); } return result; }    }### Answer:
@Test public void testReleaseAndGetSavepoint() throws Exception { try (LocalTransactionConnection connection = new LocalTransactionConnection( new MockConnection(), Connection.TRANSACTION_READ_COMMITTED, true)) { LocalTransactionContext context = new LocalTransactionContext(); context.addSavepoint("1", new MySavepoint("1")); context.addSavepoint("2", new MySavepoint("2")); context.addSavepoint("3", new MySavepoint("3")); context.addSavepoint("4", new MySavepoint("4")); context.addSavepoint("5", new MySavepoint("5")); Savepoint savepoint = context.releaseAndGetSavepoint("3"); assertEquals("3", savepoint.getSavepointName()); assertNotNull(context.getSavepoint("1")); assertNotNull(context.getSavepoint("2")); assertNull(context.getSavepoint("3")); assertNull(context.getSavepoint("4")); assertNull(context.getSavepoint("5")); } }