### Question:
KeyStoreImpl implements KeyStore { @Override public void deleteAccount(int index) throws DeleteAccountException { JSONObject json = new JSONObject(); try { JSONArray jsonArray = loadJsonArray(); if (jsonArray != null) { JSONArray newJsonArray = new JSONArray(); for (int i = 0; i < jsonArray.length(); i++) { if (i != index) { newJsonArray.put(jsonArray.get(i)); } } json.put(JSON_KEY_ACCOUNTS_ARRAY, newJsonArray); } } catch (JSONException e) { throw new DeleteAccountException(e); } store.saveString(STORE_KEY_ACCOUNTS, json.toString()); } KeyStoreImpl(@NonNull Store store, @NonNull BackupRestore backupRestore); @NonNull @Override List<KeyPair> loadAccounts(); @Override void deleteAccount(int index); @Override KeyPair newAccount(); @Override KeyPair importAccount(@NonNull String json, @NonNull String passphrase); @Override void clearAllAccounts();  }### Answer:
@Test public void deleteAccount() throws Exception { KeyStoreImpl keyStore = new KeyStoreImpl(new FakeStore(), new FakeBackupRestore()); KeyPair account1 = keyStore.newAccount(); keyStore.newAccount(); keyStore.deleteAccount(1); List<KeyPair> accounts = keyStore.loadAccounts(); assertEquals(1, accounts.size()); assertEquals(String.valueOf(account1.getSecretSeed()), String.valueOf(accounts.get(0).getSecretSeed())); }