use of org.aion.rpc.types.RPCTypesConverter.AddressListConverter in project aion by aionnetwork.
the class PersonalRPCImplTest method testPersonal_ListAccounts.
@Test
public void testPersonal_ListAccounts() {
List<AionAddress> address = new ArrayList<>();
AccountManager accountManager = new AccountManager(AionLoggerFactory.getLogger(LogEnum.API.name()));
int addressCount = 3;
for (int i = 0; i < addressCount; i++) {
address.add(accountManager.createAccount("password"));
}
chainHolder = spy(new AionChainHolder(AionImpl.instForTest(), accountManager));
doCallRealMethod().when(chainHolder).listAccounts();
rpc = spy(new RPCMethods(chainHolder));
doCallRealMethod().when(rpc).personal_listAccounts();
Request request = new Request(idGenerator.generateID(), listAccountMethod, null, VersionType.Version2);
List<AionAddress> aionAddressList = execute(request, AddressListConverter::decode);
verify(chainHolder, atLeastOnce()).listAccounts();
assertEquals(addressCount, aionAddressList.size());
// check that we get all
assertEquals(Set.copyOf(address), Set.copyOf(aionAddressList));
// the expected addresses
}
Aggregations