Search in sources :

Example 16 with AccountInfo

use of io.nem.symbol.sdk.model.account.AccountInfo in project nem2-sdk-java by nemtech.

the class StateProofServiceTest method account.

@Test
void account() throws Exception {
    AccountRepository repository = mock(AccountRepository.class);
    when(factory.createAccountRepository()).thenReturn(repository);
    Address id = Address.generateRandom(NetworkType.MIJIN_TEST);
    AccountInfo state = Mockito.mock(AccountInfo.class);
    when(state.getAddress()).thenReturn(id);
    when(state.serialize()).thenReturn(ConvertUtils.fromHexToBytes(serialized));
    when(repository.getAccountInfo(eq(id))).thenReturn(Observable.just(state));
    when(repository.getAccountInfoMerkle(eq(id))).thenReturn(Observable.just(tree));
    StateMerkleProof<AccountInfo> proof = service.account(id).toFuture().get();
    Assertions.assertTrue(proof.isValid());
    Assertions.assertEquals(state, proof.getState());
}
Also used : Address(io.nem.symbol.sdk.model.account.Address) AccountRepository(io.nem.symbol.sdk.api.AccountRepository) RestrictionAccountRepository(io.nem.symbol.sdk.api.RestrictionAccountRepository) MultisigAccountInfo(io.nem.symbol.sdk.model.account.MultisigAccountInfo) AccountInfo(io.nem.symbol.sdk.model.account.AccountInfo) Test(org.junit.jupiter.api.Test)

Aggregations

AccountInfo (io.nem.symbol.sdk.model.account.AccountInfo)16 Address (io.nem.symbol.sdk.model.account.Address)12 Account (io.nem.symbol.sdk.model.account.Account)10 Test (org.junit.jupiter.api.Test)7 AccountRepository (io.nem.symbol.sdk.api.AccountRepository)6 AccountSearchCriteria (io.nem.symbol.sdk.api.AccountSearchCriteria)6 BigInteger (java.math.BigInteger)6 Collections (java.util.Collections)5 List (java.util.List)5 Page (io.nem.symbol.sdk.api.Page)4 AccountDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountDTO)4 AccountInfoDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountInfoDTO)4 AccountDTO (io.nem.symbol.sdk.openapi.vertx.model.AccountDTO)4 AccountInfoDTO (io.nem.symbol.sdk.openapi.vertx.model.AccountInfoDTO)4 AccountLinkPublicKeyDTO (io.nem.symbol.sdk.openapi.vertx.model.AccountLinkPublicKeyDTO)4 SupplementalPublicKeysDTO (io.nem.symbol.sdk.openapi.vertx.model.SupplementalPublicKeysDTO)4 Observable (io.reactivex.Observable)4 MultisigAccountInfo (io.nem.symbol.sdk.model.account.MultisigAccountInfo)3 MosaicId (io.nem.symbol.sdk.model.mosaic.MosaicId)3 MosaicAliasTransaction (io.nem.symbol.sdk.model.transaction.MosaicAliasTransaction)3