### Question:
LocalTransaction { public void setSavepoint(String savepointName) { if (savepointName == null) { rollbackInternal("setSavepoint"); throw new DomaNullPointerException("savepointName"); } LocalTransactionContext context = localTxContextHolder.get(); if (!isActiveInternal(context)) { throw new TransactionNotYetBegunException(Message.DOMA2053, savepointName); } String id = context.getId(); Savepoint savepoint = context.getSavepoint(savepointName); if (savepoint != null) { rollbackInternal("setSavepoint"); throw new SavepointAlreadyExistsException(savepointName); } LocalTransactionConnection connection = context.getConnection(); try { savepoint = connection.setSavepoint(savepointName); } catch (SQLException e) { rollbackInternal("setSavepoint"); throw new JdbcException(Message.DOMA2051, e, savepointName, e); } context.addSavepoint(savepointName, savepoint); jdbcLogger.logTransactionSavepointCreated(className, "setSavepoint", id, savepointName); } protected  LocalTransaction(
      DataSource dataSource,
      ThreadLocal<LocalTransactionContext> localTxContextHolder,
      JdbcLogger jdbcLogger); protected  LocalTransaction(
      DataSource dataSource,
      ThreadLocal<LocalTransactionContext> localTxContextHolder,
      JdbcLogger jdbcLogger,
      TransactionIsolationLevel defaultTransactionIsolationLevel); void begin(); void begin(TransactionIsolationLevel transactionIsolationLevel); void commit(); LocalTransactionContext suspend(); void resume(LocalTransactionContext context); void rollback(); void setSavepoint(String savepointName); boolean hasSavepoint(String savepointName); void releaseSavepoint(String savepointName); void rollback(String savepointName); @Override String toString(); boolean isActive(); void setRollbackOnly(); boolean isRollbackOnly();  }### Answer:
@Test public void testSetSavepoint() { transaction.begin(); transaction.setSavepoint("hoge"); assertTrue(transaction.isActive()); assertFalse(connection.autoCommit); assertTrue(connection.savepointNames.contains("hoge")); }
@Test public void testSetSavepoint_notYetBegun() { try { transaction.setSavepoint("hoge"); fail(); } catch (TransactionNotYetBegunException expected) { System.out.println(expected.getMessage()); } }