PotentialMatchSyncService implements SyncService<PotentialMatch> { @Override public PotentialMatch getRecord(String resourceUrl) throws IOException, JSONException, HttpException { PotentialMatch potentialMatch = entityHttpDao.get(resourceUrl); potentialMatch.setSynced(true); return potentialMatch; } @Inject  PotentialMatchSyncService(RapidFtrApplication rapidFtrApplication, PotentialMatchRepository repository); @Override PotentialMatch sync(PotentialMatch record, User currentUser); @Override PotentialMatch getRecord(String resourceUrl); List<String> getIdsToDownload(); @Override void setMedia(PotentialMatch potentialMatch); @Override int getNotificationId(); @Override String getNotificationTitle(); @Override void setLastSyncedAt(PotentialMatch potentialMatch); static final String POTENTIAL_MATCH_API_PATH; static final String POTENTIAL_MATCH_API_PARAMETER; }
@Test public void shouldGetPotentialMatch() throws IOException, JSONException, HttpException { String resourceUrl = "http: String response = "{\"_id\" : \"couch_id\", \"child_id\":\"a0b2135fff78223s4h1edc\",\"enquiry_id\":\"78223s4h1e468f5200edc\"}"; getFakeHttpLayer().addHttpResponseRule("http: PotentialMatchSyncService service = new PotentialMatchSyncService(mockContext(), repository); PotentialMatch record = service.getRecord(resourceUrl); assertEquals("a0b2135fff78223s4h1edc", record.getChildId()); assertEquals("78223s4h1e468f5200edc", record.getEnquiryId()); assertEquals("couch_id", record.getUniqueId()); }