use of com.hedera.hashgraph.sdk.TokenDissociateTransaction in project hedera-mirror-node by hashgraph.
the class TokenDissociateTransactionSupplierTest method createWithCustomData.
@Test
void createWithCustomData() {
TokenDissociateTransactionSupplier tokenDissociateTransactionSupplier = new TokenDissociateTransactionSupplier();
tokenDissociateTransactionSupplier.setAccountId(ACCOUNT_ID.toString());
tokenDissociateTransactionSupplier.setMaxTransactionFee(1);
tokenDissociateTransactionSupplier.setTokenId(TOKEN_ID.toString());
TokenDissociateTransaction actual = tokenDissociateTransactionSupplier.get();
assertThat(actual).returns(ACCOUNT_ID, TokenDissociateTransaction::getAccountId).returns(ONE_TINYBAR, TokenDissociateTransaction::getMaxTransactionFee).returns(List.of(TOKEN_ID), TokenDissociateTransaction::getTokenIds);
}
use of com.hedera.hashgraph.sdk.TokenDissociateTransaction in project hedera-mirror-node by hashgraph.
the class TokenDissociateTransactionSupplierTest method createWithMinimumData.
@Test
void createWithMinimumData() {
TokenDissociateTransactionSupplier tokenDissociateTransactionSupplier = new TokenDissociateTransactionSupplier();
tokenDissociateTransactionSupplier.setAccountId(ACCOUNT_ID.toString());
tokenDissociateTransactionSupplier.setTokenId(TOKEN_ID.toString());
TokenDissociateTransaction actual = tokenDissociateTransactionSupplier.get();
assertThat(actual).returns(ACCOUNT_ID, TokenDissociateTransaction::getAccountId).returns(MAX_TRANSACTION_FEE_HBAR, TokenDissociateTransaction::getMaxTransactionFee).returns(List.of(TOKEN_ID), TokenDissociateTransaction::getTokenIds);
}
use of com.hedera.hashgraph.sdk.TokenDissociateTransaction in project hedera-sdk-java by hashgraph.
the class TokenDissociateIntegrationTest method cannotDissociateAccountFromTokenWhenAccountWasNotAssociatedWith.
@Test
@DisplayName("Cannot dissociate account from token when account was not associated with")
void cannotDissociateAccountFromTokenWhenAccountWasNotAssociatedWith() throws Exception {
var testEnv = new IntegrationTestEnv(1).useThrowawayAccount();
var key = PrivateKey.generateED25519();
var response = new AccountCreateTransaction().setKey(key).setInitialBalance(new Hbar(1)).execute(testEnv.client);
var accountId = Objects.requireNonNull(response.getReceipt(testEnv.client).accountId);
var tokenId = Objects.requireNonNull(new TokenCreateTransaction().setTokenName("ffff").setTokenSymbol("F").setDecimals(3).setInitialSupply(1000000).setTreasuryAccountId(testEnv.operatorId).setAdminKey(testEnv.operatorKey).setFreezeKey(testEnv.operatorKey).setWipeKey(testEnv.operatorKey).setKycKey(testEnv.operatorKey).setSupplyKey(testEnv.operatorKey).setFreezeDefault(false).execute(testEnv.client).getReceipt(testEnv.client).tokenId);
assertThatExceptionOfType(ReceiptStatusException.class).isThrownBy(() -> {
new TokenDissociateTransaction().setAccountId(accountId).setTokenIds(Collections.singletonList(tokenId)).freezeWith(testEnv.client).sign(key).execute(testEnv.client).getReceipt(testEnv.client);
}).withMessageContaining(Status.TOKEN_NOT_ASSOCIATED_TO_ACCOUNT.toString());
testEnv.close(tokenId, accountId, key);
}
Aggregations