AccountsManager { public Boolean hasCorrectNonce(Accounts accounts, String addressString, BigInteger nonce) throws IOException, ClassNotFoundException { logger.traceEntry("params: {} {} {}", accounts, addressString, nonce); Util.check(accounts != null, "accounts!=null"); Util.check(!(addressString == null || addressString.isEmpty()), "addressString!=null"); return logger.traceExit(true); }  static AccountsManager instance(); Boolean hasFunds(Accounts accounts, String addressString, BigInteger value); Boolean hasCorrectNonce(Accounts accounts, String addressString, BigInteger nonce); void transferFunds(Accounts accounts, String senderAddress, String receiverAddress, BigInteger value, BigInteger nonce, ShardOperation operation);  }
@Test public void testHasCorrectNonceWithNullAccountsShouldThrowException() throws IOException, ClassNotFoundException { expected(IllegalArgumentException.class, "accounts!=null"); accountsManager.hasCorrectNonce(null, "Test", BigInteger.TEN); }
@Test public void testHasCorrectNonceWithNullAddressShouldThrowException() throws IOException, ClassNotFoundException { expected(IllegalArgumentException.class, "addressString!=null"); accountsManager.hasCorrectNonce(accounts, null, BigInteger.TEN); }
@Test public void testHasCorrectNonce() throws IOException, ClassNotFoundException { AccountAddress test = AccountAddress.fromHexString("Test"); AccountState senderAccountState = AppServiceProvider.getAccountStateService().getOrCreateAccountState(test, accounts); senderAccountState.setNonce(BigInteger.TEN); AppServiceProvider.getAccountStateService().setAccountState(test, senderAccountState, accounts); Assert.assertTrue(accountsManager.hasCorrectNonce(accounts, "Test", BigInteger.TEN)); }