Skip to content

Instantly share code, notes, and snippets.

@izmajlowiczl
Last active January 4, 2017 21:33
Show Gist options
  • Select an option

  • Save izmajlowiczl/b82c21b52aec7bba5dda8d3baf33607d to your computer and use it in GitHub Desktop.

Select an option

Save izmajlowiczl/b82c21b52aec7bba5dda8d3baf33607d to your computer and use it in GitHub Desktop.
@Test
public void storeSingleWallet() {
Wallet bankWallet = Wallet.create(randomUUID(), "bank");
storage.insert(bankWallet);
assertThat(getStoredWalletNames())
.containsExactly("bank");
}
private List<String> getStoredWalletNames() {
Cursor cursor = db.rawQuery(listWalletNamesSql(), null);
if (cursor == null) {
fail("Wallet was not stored");
cursor.close();
}
List<String> storedWalletNames = new ArrayList<>();
while (cursor.moveToNext()) {
storedWalletNames.add(cursor.getString(0));
}
return storedWalletNames;
}
private String listWalletNamesSql() {
return String.format("SELECT name FROM tbl_wallet");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment