Search in sources :

Example 6 with TokenRevokeKycTransaction

use of com.hedera.hashgraph.sdk.TokenRevokeKycTransaction in project hedera-sdk-java by hashgraph.

the class TokenRevokeKycIntegrationTest method cannotRevokeKycToAccountOnTokenWhenAccountWasNotAssociatedWith.

@Test
@DisplayName("Cannot revoke kyc to account on token when account was not associated with")
void cannotRevokeKycToAccountOnTokenWhenAccountWasNotAssociatedWith() 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 TokenRevokeKycTransaction().setAccountId(accountId).setTokenId(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);
}
Also used : TokenRevokeKycTransaction(com.hedera.hashgraph.sdk.TokenRevokeKycTransaction) Hbar(com.hedera.hashgraph.sdk.Hbar) TokenCreateTransaction(com.hedera.hashgraph.sdk.TokenCreateTransaction) AccountCreateTransaction(com.hedera.hashgraph.sdk.AccountCreateTransaction) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

TokenRevokeKycTransaction (com.hedera.hashgraph.sdk.TokenRevokeKycTransaction)6 Test (org.junit.jupiter.api.Test)5 AccountCreateTransaction (com.hedera.hashgraph.sdk.AccountCreateTransaction)3 Hbar (com.hedera.hashgraph.sdk.Hbar)3 DisplayName (org.junit.jupiter.api.DisplayName)3 TokenCreateTransaction (com.hedera.hashgraph.sdk.TokenCreateTransaction)2 AbstractTransactionSupplierTest (com.hedera.mirror.monitor.publish.transaction.AbstractTransactionSupplierTest)2 TokenAssociateTransaction (com.hedera.hashgraph.sdk.TokenAssociateTransaction)1 NetworkTransactionResponse (com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse)1