PotentialMatchRepository implements Closeable, Repository<PotentialMatch> { @Override public PotentialMatch get(String id) throws JSONException { @Cleanup Cursor cursor = session.rawQuery("SELECT * FROM potential_match WHERE id = ?", new String[]{id}); if (cursor.moveToNext()) { return buildPotentialMatch(cursor); } else { return null; } } @Inject  PotentialMatchRepository(@Named("USER_NAME") String userName, DatabaseSession session); @Override void close(); @Override List<PotentialMatch> toBeSynced(); @Override boolean exists(String id); @Override PotentialMatch get(String id); @Override int size(); @Override void createOrUpdate(PotentialMatch potentialMatch); @Override HashMap<String, String> getAllIdsAndRevs(); @Override void createOrUpdateWithoutHistory(PotentialMatch potentialMatch); void delete(PotentialMatch potentialMatch); @Override List<PotentialMatch> currentUsersUnsyncedRecords(); @Override List<String> getRecordIdsByOwner(); @Override List<PotentialMatch> allCreatedByCurrentUser(); @Override List<PotentialMatch> getRecordsBetween(int previousPageNumber, int pageNumber); @Override List<PotentialMatch> getRecordsForFirstPage(); List<PotentialMatch> getPotentialMatchesFor(Enquiry enquiry); List<PotentialMatch> getPotentialMatchesFor(Child child);  }
@Test public void shouldReturnNullIfPotentialMatchDoesNotExist() throws JSONException, SQLException { assertThat(repository.get("unique_id_1"), is(nullValue())); }