Search in sources :

Example 1 with AccountsNamesDTO

use of io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountsNamesDTO in project nem2-sdk-java by nemtech.

the class NamespaceRepositoryOkHttpImplTest method shouldGetAccountsNamesFromAddresses.

@Test
public void shouldGetAccountsNamesFromAddresses() throws Exception {
    Address address = Address.generateRandom(networkType);
    AccountNamesDTO dto = new AccountNamesDTO();
    dto.setAddress(encodeAddress(address));
    dto.setNames(Collections.singletonList("accountalias"));
    AccountsNamesDTO accountsNamesDTO = new AccountsNamesDTO();
    accountsNamesDTO.setAccountNames(Collections.singletonList(dto));
    mockRemoteCall(accountsNamesDTO);
    List<AccountNames> resolvedList = repository.getAccountsNames(Collections.singletonList(address)).toFuture().get();
    Assertions.assertEquals(1, resolvedList.size());
    AccountNames accountNames = resolvedList.get(0);
    Assertions.assertEquals(address, accountNames.getAddress());
    Assertions.assertEquals("accountalias", accountNames.getNames().get(0).getName());
}
Also used : AccountsNamesDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountsNamesDTO) Address(io.nem.symbol.sdk.model.account.Address) AccountNamesDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountNamesDTO) AccountNames(io.nem.symbol.sdk.model.account.AccountNames) Test(org.junit.jupiter.api.Test)

Aggregations

AccountNames (io.nem.symbol.sdk.model.account.AccountNames)1 Address (io.nem.symbol.sdk.model.account.Address)1 AccountNamesDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountNamesDTO)1 AccountsNamesDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountsNamesDTO)1 Test (org.junit.jupiter.api.Test)1