TransactionException extends StorageException { public boolean isAlreadyExists() { return isAlreadyExists(getCause()); } TransactionException(DatastoreException cause); @Override synchronized DatastoreException getCause(); boolean isConflict(); boolean isAlreadyExists(); boolean isNotFound();  }
@Test public void isAlreadyExists() { assertThat(transactionException(1, "", "ALREADY_EXISTS").isAlreadyExists(), is(true)); assertThat(transactionException(1, "entity already exists", "").isAlreadyExists(), is(true)); assertThat(transactionException(1, "", "").isAlreadyExists(), is(false)); }