@Test public void newAccount_JsonException_CreateAccountException() throws Exception { Store mockStore = mock(Store.class); when(mockStore.getString(anyString())) .thenReturn("") .thenReturn(KeyStoreImpl.ENCRYPTION_VERSION_NAME) .thenReturn("not a real json"); KeyStoreImpl keyStore = new KeyStoreImpl(mockStore, new FakeBackupRestore()); expectedEx.expect(CreateAccountException.class); expectedEx.expectCause(isA(JSONException.class)); keyStore.newAccount(); }
@Override public KeyPair newAccount() throws CreateAccountException { return addKeyPairToStorage(KeyPair.random()); }
KeyStoreImpl implements KeyStore { @Override public KeyPair newAccount() throws CreateAccountException { return addKeyPairToStorage(KeyPair.random()); } }
KeyStoreImpl implements KeyStore { @Override public KeyPair newAccount() throws CreateAccountException { return addKeyPairToStorage(KeyPair.random()); } KeyStoreImpl(@NonNull Store store, @NonNull BackupRestore backupRestore); }
KeyStoreImpl implements KeyStore { @Override public KeyPair newAccount() throws CreateAccountException { return addKeyPairToStorage(KeyPair.random()); } KeyStoreImpl(@NonNull Store store, @NonNull BackupRestore backupRestore); @NonNull @Override List<KeyPair> loadAccounts(); @Override void deleteAccount(String publicAddress); @Override KeyPair newAccount(); @Override KeyPair importAccount(@NonNull String json, @NonNull String passphrase); @Override void clearAllAccounts(); }
KeyStoreImpl implements KeyStore { @Override public KeyPair newAccount() throws CreateAccountException { return addKeyPairToStorage(KeyPair.random()); } KeyStoreImpl(@NonNull Store store, @NonNull BackupRestore backupRestore); @NonNull @Override List<KeyPair> loadAccounts(); @Override void deleteAccount(String publicAddress); @Override KeyPair newAccount(); @Override KeyPair importAccount(@NonNull String json, @NonNull String passphrase); @Override void clearAllAccounts();  }