YkneoBitcoinSoft implements YkneoBitcoin { @Override public void resetUserPin(String newPin) throws PinModeLockedException, IOException { ensurePin(PinMode.ADMIN); userPin = newPin; userTries = userMaxRetries; } YkneoBitcoinSoft(); @Override byte[] exportExtendedPublicKey(); @Override String getAppletVersion(); @Override boolean isKeyLoaded(); @Override void unlockUser(String pin); @Override void unlockAdmin(String pin); @Override boolean isUserUnlocked(); @Override boolean isAdminUnlocked(); @Override void setUserPin(String oldPin, String newPin); @Override void setAdminPin(String oldPin, String newPin); @Override void resetUserPin(String newPin); @Override byte[] getHeader(); @Override void setAdminRetryCount(int attempts); @Override void setUserRetryCount(int attempts); @Override byte[] getPublicKey(boolean compress, int... index); @Override byte[] sign(byte[] hash, int... index); @Override byte[] generateMasterKeyPair(boolean allowExport, boolean returnPrivateKey, boolean testnetKey); @Override void importExtendedKeyPair(byte[] extendedPrivateKey, boolean allowExport);  }
@Test public void testResetUserPin() throws Exception { neo.unlockAdmin(adminPin); boolean locked = false; int tries = 10; while (!locked && tries-- > 0) { try { neo.unlockUser("foobar"); } catch (IncorrectPINException e) { locked = e.getTriesRemaining() == 0; } } assertTrue(locked); neo.resetUserPin(userPin); neo.unlockUser(userPin); }