@Test public void testLimitCapacity() { final int capacity = 3; final SimpleNonceProvider nonceProvider = new SimpleNonceProvider(capacity); for (int i = 0; i < 5 * capacity; ++i) { final AergoKey key = new AergoKeyGenerator().create(); nonceProvider.bindNonce(key.getAddress(), 3L); } assertEquals(capacity, nonceProvider.cache.size()); }
@Override public void bindNonce(final AccountState accountState) { assertNotNull(accountState, "AccountState must not null"); bindNonce(accountState.getAddress(), accountState.getNonce()); }
SimpleNonceProvider implements NonceProvider { @Override public void bindNonce(final AccountState accountState) { assertNotNull(accountState, "AccountState must not null"); bindNonce(accountState.getAddress(), accountState.getNonce()); } }
SimpleNonceProvider implements NonceProvider { @Override public void bindNonce(final AccountState accountState) { assertNotNull(accountState, "AccountState must not null"); bindNonce(accountState.getAddress(), accountState.getNonce()); } SimpleNonceProvider();  SimpleNonceProvider(final int capacity); }
SimpleNonceProvider implements NonceProvider { @Override public void bindNonce(final AccountState accountState) { assertNotNull(accountState, "AccountState must not null"); bindNonce(accountState.getAddress(), accountState.getNonce()); } SimpleNonceProvider();  SimpleNonceProvider(final int capacity); @Override void bindNonce(final AccountState accountState); @Override void bindNonce(final AccountAddress accountAddress, final long nonce); @Override long incrementAndGetNonce(final AccountAddress accountAddress); @Override long getLastUsedNonce(final AccountAddress accountAddress); @Override String toString(); }
SimpleNonceProvider implements NonceProvider { @Override public void bindNonce(final AccountState accountState) { assertNotNull(accountState, "AccountState must not null"); bindNonce(accountState.getAddress(), accountState.getNonce()); } SimpleNonceProvider();  SimpleNonceProvider(final int capacity); @Override void bindNonce(final AccountState accountState); @Override void bindNonce(final AccountAddress accountAddress, final long nonce); @Override long incrementAndGetNonce(final AccountAddress accountAddress); @Override long getLastUsedNonce(final AccountAddress accountAddress); @Override String toString();  }