target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void assertFindByCaseID() { Mockito.when(eligibleCoupleRepository.findByCaseID(Mockito.anyString())).thenReturn(Mockito.mock(EligibleCouple.class)); Assert.assertNotNull(allEligibleCouples.findByCaseID("")); } | public EligibleCouple findByCaseID(String caseId) { return eligibleCoupleRepository.findByCaseID(caseId); } | AllEligibleCouples { public EligibleCouple findByCaseID(String caseId) { return eligibleCoupleRepository.findByCaseID(caseId); } } | AllEligibleCouples { public EligibleCouple findByCaseID(String caseId) { return eligibleCoupleRepository.findByCaseID(caseId); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository
alertRepository, TimelineEventRepository timelineEventRepository); } | AllEligibleCouples { public EligibleCouple findByCaseID(String caseId) { return eligibleCoupleRepository.findByCaseID(caseId); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository
alertRepository, TimelineEventRepository timelineEventRepository); List<EligibleCouple> all()... | AllEligibleCouples { public EligibleCouple findByCaseID(String caseId) { return eligibleCoupleRepository.findByCaseID(caseId); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository
alertRepository, TimelineEventRepository timelineEventRepository); List<EligibleCouple> all()... |
@Test public void assertFindByCaseIDs() { Mockito.when(eligibleCoupleRepository.findByCaseIDs(Mockito.anyString())).thenReturn(Mockito.mock(ArrayList.class)); Assert.assertNotNull(allEligibleCouples.findByCaseIDs(new ArrayList<String>())); } | public List<EligibleCouple> findByCaseIDs(List<String> caseIds) { return eligibleCoupleRepository.findByCaseIDs(caseIds.toArray(new String[caseIds.size()])); } | AllEligibleCouples { public List<EligibleCouple> findByCaseIDs(List<String> caseIds) { return eligibleCoupleRepository.findByCaseIDs(caseIds.toArray(new String[caseIds.size()])); } } | AllEligibleCouples { public List<EligibleCouple> findByCaseIDs(List<String> caseIds) { return eligibleCoupleRepository.findByCaseIDs(caseIds.toArray(new String[caseIds.size()])); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository
alertRepository, TimelineEventRepository ... | AllEligibleCouples { public List<EligibleCouple> findByCaseIDs(List<String> caseIds) { return eligibleCoupleRepository.findByCaseIDs(caseIds.toArray(new String[caseIds.size()])); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository
alertRepository, TimelineEventRepository ... | AllEligibleCouples { public List<EligibleCouple> findByCaseIDs(List<String> caseIds) { return eligibleCoupleRepository.findByCaseIDs(caseIds.toArray(new String[caseIds.size()])); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository
alertRepository, TimelineEventRepository ... |
@Test public void assertUpdatePhotoPathCallsRepositoryUpdate() { Mockito.doNothing().when(eligibleCoupleRepository).updatePhotoPath(Mockito.anyString(), Mockito.anyString()); allEligibleCouples.updatePhotoPath("", ""); Mockito.verify(eligibleCoupleRepository, Mockito.times(1)).updatePhotoPath(Mockito.anyString(), Mocki... | public void updatePhotoPath(String caseId, String imagePath) { eligibleCoupleRepository.updatePhotoPath(caseId, imagePath); } | AllEligibleCouples { public void updatePhotoPath(String caseId, String imagePath) { eligibleCoupleRepository.updatePhotoPath(caseId, imagePath); } } | AllEligibleCouples { public void updatePhotoPath(String caseId, String imagePath) { eligibleCoupleRepository.updatePhotoPath(caseId, imagePath); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository
alertRepository, TimelineEventRepository timelineEventRepository); } | AllEligibleCouples { public void updatePhotoPath(String caseId, String imagePath) { eligibleCoupleRepository.updatePhotoPath(caseId, imagePath); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository
alertRepository, TimelineEventRepository timelineEventRepository); List<Eli... | AllEligibleCouples { public void updatePhotoPath(String caseId, String imagePath) { eligibleCoupleRepository.updatePhotoPath(caseId, imagePath); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository
alertRepository, TimelineEventRepository timelineEventRepository); List<Eli... |
@Test public void assertfillSubFormaddressEndDateAddsEndDate() throws Exception { String addressJsonWithEndDateString = "{\"entity_id\":\"mother\",\"value\":\"2017-05-22\",\"openmrs_entity\":\"person_address\"," + "\"openmrs_entity_id\":\"end_date\",\"hint\":\"address of household end date\"," + "\"openmrs_entity_paren... | public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bind == null || !bi... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... |
@Test public void assertMergeDetailsCallsRepositoryUpdate() { Mockito.doNothing().when(eligibleCoupleRepository).mergeDetails(Mockito.anyString(), Mockito.any(Map.class)); allEligibleCouples.mergeDetails("", new HashMap<String, String>()); Mockito.verify(eligibleCoupleRepository, Mockito.times(1)).mergeDetails(Mockito.... | public void mergeDetails(String entityId, Map<String, String> details) { eligibleCoupleRepository.mergeDetails(entityId, details); } | AllEligibleCouples { public void mergeDetails(String entityId, Map<String, String> details) { eligibleCoupleRepository.mergeDetails(entityId, details); } } | AllEligibleCouples { public void mergeDetails(String entityId, Map<String, String> details) { eligibleCoupleRepository.mergeDetails(entityId, details); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository
alertRepository, TimelineEventRepository timelineEventRepository); } | AllEligibleCouples { public void mergeDetails(String entityId, Map<String, String> details) { eligibleCoupleRepository.mergeDetails(entityId, details); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository
alertRepository, TimelineEventRepository timelineEventRepository); L... | AllEligibleCouples { public void mergeDetails(String entityId, Map<String, String> details) { eligibleCoupleRepository.mergeDetails(entityId, details); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository
alertRepository, TimelineEventRepository timelineEventRepository); L... |
@Test public void assertCountreturnsLong() { Mockito.when(eligibleCoupleRepository.count()).thenReturn(0l); Assert.assertEquals(allEligibleCouples.count(), 0l); } | public long count() { return eligibleCoupleRepository.count(); } | AllEligibleCouples { public long count() { return eligibleCoupleRepository.count(); } } | AllEligibleCouples { public long count() { return eligibleCoupleRepository.count(); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository
alertRepository, TimelineEventRepository timelineEventRepository); } | AllEligibleCouples { public long count() { return eligibleCoupleRepository.count(); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository
alertRepository, TimelineEventRepository timelineEventRepository); List<EligibleCouple> all(); EligibleCouple findByCaseID(String caseId... | AllEligibleCouples { public long count() { return eligibleCoupleRepository.count(); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository
alertRepository, TimelineEventRepository timelineEventRepository); List<EligibleCouple> all(); EligibleCouple findByCaseID(String caseId... |
@Test public void assertFPCountreturnsLong() { Mockito.when(eligibleCoupleRepository.fpCount()).thenReturn(0l); Assert.assertEquals(allEligibleCouples.fpCount(), 0l); } | public long fpCount() { return eligibleCoupleRepository.fpCount(); } | AllEligibleCouples { public long fpCount() { return eligibleCoupleRepository.fpCount(); } } | AllEligibleCouples { public long fpCount() { return eligibleCoupleRepository.fpCount(); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository
alertRepository, TimelineEventRepository timelineEventRepository); } | AllEligibleCouples { public long fpCount() { return eligibleCoupleRepository.fpCount(); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository
alertRepository, TimelineEventRepository timelineEventRepository); List<EligibleCouple> all(); EligibleCouple findByCaseID(String ca... | AllEligibleCouples { public long fpCount() { return eligibleCoupleRepository.fpCount(); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository
alertRepository, TimelineEventRepository timelineEventRepository); List<EligibleCouple> all(); EligibleCouple findByCaseID(String ca... |
@Test public void assertVillagesReturnsList() { Mockito.when(eligibleCoupleRepository.villages()).thenReturn(new ArrayList<String>()); Assert.assertNotNull(allEligibleCouples.villages()); } | public List<String> villages() { return eligibleCoupleRepository.villages(); } | AllEligibleCouples { public List<String> villages() { return eligibleCoupleRepository.villages(); } } | AllEligibleCouples { public List<String> villages() { return eligibleCoupleRepository.villages(); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository
alertRepository, TimelineEventRepository timelineEventRepository); } | AllEligibleCouples { public List<String> villages() { return eligibleCoupleRepository.villages(); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository
alertRepository, TimelineEventRepository timelineEventRepository); List<EligibleCouple> all(); EligibleCouple findByCaseID... | AllEligibleCouples { public List<String> villages() { return eligibleCoupleRepository.villages(); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository
alertRepository, TimelineEventRepository timelineEventRepository); List<EligibleCouple> all(); EligibleCouple findByCaseID... |
@Test public void assertOnCreateCallDatabaseExecSql() { motherRepository.onCreate(sqLiteDatabase); Mockito.verify(sqLiteDatabase, Mockito.times(3)).execSQL(Mockito.anyString()); } | @Override protected void onCreate(SQLiteDatabase database) { database.execSQL(MOTHER_SQL); database.execSQL(MOTHER_TYPE_INDEX_SQL); database.execSQL(MOTHER_REFERENCE_DATE_INDEX_SQL); } | MotherRepository extends DrishtiRepository { @Override protected void onCreate(SQLiteDatabase database) { database.execSQL(MOTHER_SQL); database.execSQL(MOTHER_TYPE_INDEX_SQL); database.execSQL(MOTHER_REFERENCE_DATE_INDEX_SQL); } } | MotherRepository extends DrishtiRepository { @Override protected void onCreate(SQLiteDatabase database) { database.execSQL(MOTHER_SQL); database.execSQL(MOTHER_TYPE_INDEX_SQL); database.execSQL(MOTHER_REFERENCE_DATE_INDEX_SQL); } } | MotherRepository extends DrishtiRepository { @Override protected void onCreate(SQLiteDatabase database) { database.execSQL(MOTHER_SQL); database.execSQL(MOTHER_TYPE_INDEX_SQL); database.execSQL(MOTHER_REFERENCE_DATE_INDEX_SQL); } void add(Mother mother); void switchToPNC(String caseId); List<Mother> allANCs(); Mother ... | MotherRepository extends DrishtiRepository { @Override protected void onCreate(SQLiteDatabase database) { database.execSQL(MOTHER_SQL); database.execSQL(MOTHER_TYPE_INDEX_SQL); database.execSQL(MOTHER_REFERENCE_DATE_INDEX_SQL); } void add(Mother mother); void switchToPNC(String caseId); List<Mother> allANCs(); Mother ... |
@Test public void assertAddMotherCallsDatabaseSqlInsert() { motherRepository.updateMasterRepository(repository); Mockito.when(repository.getWritableDatabase()).thenReturn(sqLiteDatabase); motherRepository.add(getMockMother()); Mockito.verify(sqLiteDatabase, Mockito.times(1)).insert(Mockito.anyString(), Mockito.isNull(S... | public void add(Mother mother) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.insert(MOTHER_TABLE_NAME, null, createValuesFor(mother, TYPE_ANC)); } | MotherRepository extends DrishtiRepository { public void add(Mother mother) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.insert(MOTHER_TABLE_NAME, null, createValuesFor(mother, TYPE_ANC)); } } | MotherRepository extends DrishtiRepository { public void add(Mother mother) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.insert(MOTHER_TABLE_NAME, null, createValuesFor(mother, TYPE_ANC)); } } | MotherRepository extends DrishtiRepository { public void add(Mother mother) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.insert(MOTHER_TABLE_NAME, null, createValuesFor(mother, TYPE_ANC)); } void add(Mother mother); void switchToPNC(String caseId); List<Mother> allANCs(); Mother findByI... | MotherRepository extends DrishtiRepository { public void add(Mother mother) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.insert(MOTHER_TABLE_NAME, null, createValuesFor(mother, TYPE_ANC)); } void add(Mother mother); void switchToPNC(String caseId); List<Mother> allANCs(); Mother findByI... |
@Test public void assertUpdateMotherCallsDatabaseUpdate() { motherRepository.updateMasterRepository(repository); Mockito.when(repository.getWritableDatabase()).thenReturn(sqLiteDatabase); Mockito.when(sqLiteDatabase.update(Mockito.anyString(), Mockito.any(ContentValues.class), Mockito.anyString(), Mockito.any(String[].... | public void update(Mother mother) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.update(MOTHER_TABLE_NAME, createValuesFor(mother, TYPE_ANC), ID_COLUMN + " = ?", new String[]{mother.caseId()}); } | MotherRepository extends DrishtiRepository { public void update(Mother mother) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.update(MOTHER_TABLE_NAME, createValuesFor(mother, TYPE_ANC), ID_COLUMN + " = ?", new String[]{mother.caseId()}); } } | MotherRepository extends DrishtiRepository { public void update(Mother mother) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.update(MOTHER_TABLE_NAME, createValuesFor(mother, TYPE_ANC), ID_COLUMN + " = ?", new String[]{mother.caseId()}); } } | MotherRepository extends DrishtiRepository { public void update(Mother mother) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.update(MOTHER_TABLE_NAME, createValuesFor(mother, TYPE_ANC), ID_COLUMN + " = ?", new String[]{mother.caseId()}); } void add(Mother mother); void switchToPNC(String... | MotherRepository extends DrishtiRepository { public void update(Mother mother) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.update(MOTHER_TABLE_NAME, createValuesFor(mother, TYPE_ANC), ID_COLUMN + " = ?", new String[]{mother.caseId()}); } void add(Mother mother); void switchToPNC(String... |
@Test public void assertAllANCsCallsDatabaseQueryAndReturnsListOfANCs() { motherRepository.updateMasterRepository(repository); Mockito.when(repository.getWritableDatabase()).thenReturn(sqLiteDatabase); Mockito.when(repository.getReadableDatabase()).thenReturn(sqLiteDatabase); Mockito.when(sqLiteDatabase.query(Mockito.a... | public List<Mother> allANCs() { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, TYPE_COLUMN + " = ? AND " + IS_CLOSED_COLUMN + " = ?", new String[]{TYPE_ANC, NOT_CLOSED}, null, null, null, null); return readAll(cursor); } | MotherRepository extends DrishtiRepository { public List<Mother> allANCs() { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, TYPE_COLUMN + " = ? AND " + IS_CLOSED_COLUMN + " = ?", new String[]{TYPE_ANC, NOT_CLOSED}, null, null, nu... | MotherRepository extends DrishtiRepository { public List<Mother> allANCs() { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, TYPE_COLUMN + " = ? AND " + IS_CLOSED_COLUMN + " = ?", new String[]{TYPE_ANC, NOT_CLOSED}, null, null, nu... | MotherRepository extends DrishtiRepository { public List<Mother> allANCs() { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, TYPE_COLUMN + " = ? AND " + IS_CLOSED_COLUMN + " = ?", new String[]{TYPE_ANC, NOT_CLOSED}, null, null, nu... | MotherRepository extends DrishtiRepository { public List<Mother> allANCs() { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, TYPE_COLUMN + " = ? AND " + IS_CLOSED_COLUMN + " = ?", new String[]{TYPE_ANC, NOT_CLOSED}, null, null, nu... |
@Test public void assertAllPNCsCallsDatabaseQueryAndReturnsListOfANCs() { motherRepository.updateMasterRepository(repository); Mockito.when(repository.getWritableDatabase()).thenReturn(sqLiteDatabase); Mockito.when(repository.getReadableDatabase()).thenReturn(sqLiteDatabase); Mockito.when(sqLiteDatabase.query(Mockito.a... | public List<Mother> allPNCs() { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, TYPE_COLUMN + " =" + " ? AND " + IS_CLOSED_COLUMN + " = ?", new String[]{TYPE_PNC, NOT_CLOSED}, null, null, null, null); return readAll(cursor); } | MotherRepository extends DrishtiRepository { public List<Mother> allPNCs() { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, TYPE_COLUMN + " =" + " ? AND " + IS_CLOSED_COLUMN + " = ?", new String[]{TYPE_PNC, NOT_CLOSED}, null, nul... | MotherRepository extends DrishtiRepository { public List<Mother> allPNCs() { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, TYPE_COLUMN + " =" + " ? AND " + IS_CLOSED_COLUMN + " = ?", new String[]{TYPE_PNC, NOT_CLOSED}, null, nul... | MotherRepository extends DrishtiRepository { public List<Mother> allPNCs() { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, TYPE_COLUMN + " =" + " ? AND " + IS_CLOSED_COLUMN + " = ?", new String[]{TYPE_PNC, NOT_CLOSED}, null, nul... | MotherRepository extends DrishtiRepository { public List<Mother> allPNCs() { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, TYPE_COLUMN + " =" + " ? AND " + IS_CLOSED_COLUMN + " = ?", new String[]{TYPE_PNC, NOT_CLOSED}, null, nul... |
@Test public void assertAllECCallsDatabaseQueryAndReturnsListOfANCs() { motherRepository.updateMasterRepository(repository); Mockito.when(repository.getWritableDatabase()).thenReturn(sqLiteDatabase); Mockito.when(repository.getReadableDatabase()).thenReturn(sqLiteDatabase); Mockito.when(sqLiteDatabase.query(Mockito.any... | public List<Mother> findAllCasesForEC(String ecCaseId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database .query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, EC_CASEID_COLUMN + " = ?", new String[]{ecCaseId}, null, null, null, null); return readAll(cursor); } | MotherRepository extends DrishtiRepository { public List<Mother> findAllCasesForEC(String ecCaseId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database .query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, EC_CASEID_COLUMN + " = ?", new String[]{ecCaseId}, null, null, null, null); ret... | MotherRepository extends DrishtiRepository { public List<Mother> findAllCasesForEC(String ecCaseId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database .query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, EC_CASEID_COLUMN + " = ?", new String[]{ecCaseId}, null, null, null, null); ret... | MotherRepository extends DrishtiRepository { public List<Mother> findAllCasesForEC(String ecCaseId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database .query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, EC_CASEID_COLUMN + " = ?", new String[]{ecCaseId}, null, null, null, null); ret... | MotherRepository extends DrishtiRepository { public List<Mother> findAllCasesForEC(String ecCaseId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database .query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, EC_CASEID_COLUMN + " = ?", new String[]{ecCaseId}, null, null, null, null); ret... |
@Test public void assertfillSubFormaddressLongitudeAddsLongitude() throws Exception { String addressJsonWithLongitudeString = "{\"entity_id\":\"mother\",\"value\":\"34.044494\",\"openmrs_entity\":\"person_address\"," + "\"openmrs_entity_id\":\"longitude\",\"hint\":\"address of household longitude\"," + "\"openmrs_entit... | public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bind == null || !bi... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... |
@Test public void assertFindMotherByIdReturnsMother() { motherRepository.updateMasterRepository(repository); Mockito.when(repository.getReadableDatabase()).thenReturn(sqLiteDatabase); Mockito.when(sqLiteDatabase.query(Mockito.anyString(), Mockito.any(String[].class), Mockito.anyString(), Mockito.any(String[].class), Mo... | public Mother findById(String entityId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database .query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, ID_COLUMN + " = ?", new String[]{entityId}, null, null, null, null); return readAll(cursor).get(0); } | MotherRepository extends DrishtiRepository { public Mother findById(String entityId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database .query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, ID_COLUMN + " = ?", new String[]{entityId}, null, null, null, null); return readAll(cursor).ge... | MotherRepository extends DrishtiRepository { public Mother findById(String entityId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database .query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, ID_COLUMN + " = ?", new String[]{entityId}, null, null, null, null); return readAll(cursor).ge... | MotherRepository extends DrishtiRepository { public Mother findById(String entityId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database .query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, ID_COLUMN + " = ?", new String[]{entityId}, null, null, null, null); return readAll(cursor).ge... | MotherRepository extends DrishtiRepository { public Mother findById(String entityId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database .query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, ID_COLUMN + " = ?", new String[]{entityId}, null, null, null, null); return readAll(cursor).ge... |
@Test public void assertFindMotherWithOpenStatusByECIdReturnsMother() { motherRepository.updateMasterRepository(repository); Mockito.when(repository.getReadableDatabase()).thenReturn(sqLiteDatabase); Mockito.when(sqLiteDatabase.query(Mockito.anyString(), Mockito.any(String[].class), Mockito.anyString(), Mockito.any(Str... | public Mother findMotherWithOpenStatusByECId(String ecId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, EC_CASEID_COLUMN + " = ? AND " + IS_CLOSED_COLUMN + " = ?", new String[]{ecId, NOT_CLOSED}, null, null, null, null); List<... | MotherRepository extends DrishtiRepository { public Mother findMotherWithOpenStatusByECId(String ecId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, EC_CASEID_COLUMN + " = ? AND " + IS_CLOSED_COLUMN + " = ?", new String[]{ecId... | MotherRepository extends DrishtiRepository { public Mother findMotherWithOpenStatusByECId(String ecId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, EC_CASEID_COLUMN + " = ? AND " + IS_CLOSED_COLUMN + " = ?", new String[]{ecId... | MotherRepository extends DrishtiRepository { public Mother findMotherWithOpenStatusByECId(String ecId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, EC_CASEID_COLUMN + " = ? AND " + IS_CLOSED_COLUMN + " = ?", new String[]{ecId... | MotherRepository extends DrishtiRepository { public Mother findMotherWithOpenStatusByECId(String ecId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, EC_CASEID_COLUMN + " = ? AND " + IS_CLOSED_COLUMN + " = ?", new String[]{ecId... |
@Test public void assertFindCaseByIdReturnsMother() { motherRepository.updateMasterRepository(repository); Mockito.when(repository.getReadableDatabase()).thenReturn(sqLiteDatabase); Mockito.when(sqLiteDatabase.query(Mockito.anyString(), Mockito.any(String[].class), Mockito.anyString(), Mockito.any(String[].class), Mock... | public Mother findOpenCaseByCaseID(String caseId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, ID_COLUMN + " = ? AND " + IS_CLOSED_COLUMN + " = ?", new String[]{caseId, NOT_CLOSED}, null, null, null, null); List<Mother> mothe... | MotherRepository extends DrishtiRepository { public Mother findOpenCaseByCaseID(String caseId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, ID_COLUMN + " = ? AND " + IS_CLOSED_COLUMN + " = ?", new String[]{caseId, NOT_CLOSED}... | MotherRepository extends DrishtiRepository { public Mother findOpenCaseByCaseID(String caseId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, ID_COLUMN + " = ? AND " + IS_CLOSED_COLUMN + " = ?", new String[]{caseId, NOT_CLOSED}... | MotherRepository extends DrishtiRepository { public Mother findOpenCaseByCaseID(String caseId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, ID_COLUMN + " = ? AND " + IS_CLOSED_COLUMN + " = ?", new String[]{caseId, NOT_CLOSED}... | MotherRepository extends DrishtiRepository { public Mother findOpenCaseByCaseID(String caseId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS, ID_COLUMN + " = ? AND " + IS_CLOSED_COLUMN + " = ?", new String[]{caseId, NOT_CLOSED}... |
@Test public void assertFindCaseByIdsReturnsMotherList() { motherRepository.updateMasterRepository(repository); Mockito.when(repository.getReadableDatabase()).thenReturn(sqLiteDatabase); Mockito.when(sqLiteDatabase.rawQuery(Mockito.anyString(), Mockito.any(String[].class))).thenReturn(getMotherCursor()); Assert.assertN... | public List<Mother> findByCaseIds(String... caseIds) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.rawQuery( String.format("SELECT * FROM %s WHERE %s IN (%s)", MOTHER_TABLE_NAME, ID_COLUMN, insertPlaceholdersForInClause(caseIds.length)), caseIds); return readAll(cursor); } | MotherRepository extends DrishtiRepository { public List<Mother> findByCaseIds(String... caseIds) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.rawQuery( String.format("SELECT * FROM %s WHERE %s IN (%s)", MOTHER_TABLE_NAME, ID_COLUMN, insertPlaceholdersForInClause(caseIds.... | MotherRepository extends DrishtiRepository { public List<Mother> findByCaseIds(String... caseIds) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.rawQuery( String.format("SELECT * FROM %s WHERE %s IN (%s)", MOTHER_TABLE_NAME, ID_COLUMN, insertPlaceholdersForInClause(caseIds.... | MotherRepository extends DrishtiRepository { public List<Mother> findByCaseIds(String... caseIds) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.rawQuery( String.format("SELECT * FROM %s WHERE %s IN (%s)", MOTHER_TABLE_NAME, ID_COLUMN, insertPlaceholdersForInClause(caseIds.... | MotherRepository extends DrishtiRepository { public List<Mother> findByCaseIds(String... caseIds) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.rawQuery( String.format("SELECT * FROM %s WHERE %s IN (%s)", MOTHER_TABLE_NAME, ID_COLUMN, insertPlaceholdersForInClause(caseIds.... |
@Test(expected = Exception.class) public void assertAllMothersOfATypeWithECReturnsNull() { motherRepository.updateMasterRepository(repository); Mockito.when(repository.getReadableDatabase()).thenReturn(sqLiteDatabase); Assert.assertNull(motherRepository.allMothersOfATypeWithEC("type")); } | public List<Pair<Mother, EligibleCouple>> allMothersOfATypeWithEC(String type) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.rawQuery( "SELECT " + tableColumnsForQuery(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS) + ", " + tableColumnsForQuery(EC_TABLE_NAME, EC_TABLE_COLUMNS) +... | MotherRepository extends DrishtiRepository { public List<Pair<Mother, EligibleCouple>> allMothersOfATypeWithEC(String type) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.rawQuery( "SELECT " + tableColumnsForQuery(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS) + ", " + tableColum... | MotherRepository extends DrishtiRepository { public List<Pair<Mother, EligibleCouple>> allMothersOfATypeWithEC(String type) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.rawQuery( "SELECT " + tableColumnsForQuery(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS) + ", " + tableColum... | MotherRepository extends DrishtiRepository { public List<Pair<Mother, EligibleCouple>> allMothersOfATypeWithEC(String type) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.rawQuery( "SELECT " + tableColumnsForQuery(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS) + ", " + tableColum... | MotherRepository extends DrishtiRepository { public List<Pair<Mother, EligibleCouple>> allMothersOfATypeWithEC(String type) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.rawQuery( "SELECT " + tableColumnsForQuery(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS) + ", " + tableColum... |
@Test public void assertAllMothersOfATypeWithECReturnsAllMother() { motherRepository.updateMasterRepository(repository); Mockito.when(repository.getReadableDatabase()).thenReturn(sqLiteDatabase); Mockito.when(sqLiteDatabase.rawQuery(Mockito.anyString(), Mockito.any(String[].class))).thenReturn(getJoinCursor()); Assert.... | public List<Pair<Mother, EligibleCouple>> allMothersOfATypeWithEC(String type) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.rawQuery( "SELECT " + tableColumnsForQuery(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS) + ", " + tableColumnsForQuery(EC_TABLE_NAME, EC_TABLE_COLUMNS) +... | MotherRepository extends DrishtiRepository { public List<Pair<Mother, EligibleCouple>> allMothersOfATypeWithEC(String type) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.rawQuery( "SELECT " + tableColumnsForQuery(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS) + ", " + tableColum... | MotherRepository extends DrishtiRepository { public List<Pair<Mother, EligibleCouple>> allMothersOfATypeWithEC(String type) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.rawQuery( "SELECT " + tableColumnsForQuery(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS) + ", " + tableColum... | MotherRepository extends DrishtiRepository { public List<Pair<Mother, EligibleCouple>> allMothersOfATypeWithEC(String type) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.rawQuery( "SELECT " + tableColumnsForQuery(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS) + ", " + tableColum... | MotherRepository extends DrishtiRepository { public List<Pair<Mother, EligibleCouple>> allMothersOfATypeWithEC(String type) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.rawQuery( "SELECT " + tableColumnsForQuery(MOTHER_TABLE_NAME, MOTHER_TABLE_COLUMNS) + ", " + tableColum... |
@Test public void assertCloseAllCasesForECCallsDatabaseUpdate() { motherRepository.updateMasterRepository(repository); Mockito.when(repository.getReadableDatabase()).thenReturn(sqLiteDatabase); Mockito.when(repository.getWritableDatabase()).thenReturn(sqLiteDatabase); Mockito.when(sqLiteDatabase.query(Mockito.anyString... | public void closeAllCasesForEC(String ecCaseId) { List<Mother> mothers = findAllCasesForEC(ecCaseId); for (Mother mother : mothers) { close(mother.caseId()); } } | MotherRepository extends DrishtiRepository { public void closeAllCasesForEC(String ecCaseId) { List<Mother> mothers = findAllCasesForEC(ecCaseId); for (Mother mother : mothers) { close(mother.caseId()); } } } | MotherRepository extends DrishtiRepository { public void closeAllCasesForEC(String ecCaseId) { List<Mother> mothers = findAllCasesForEC(ecCaseId); for (Mother mother : mothers) { close(mother.caseId()); } } } | MotherRepository extends DrishtiRepository { public void closeAllCasesForEC(String ecCaseId) { List<Mother> mothers = findAllCasesForEC(ecCaseId); for (Mother mother : mothers) { close(mother.caseId()); } } void add(Mother mother); void switchToPNC(String caseId); List<Mother> allANCs(); Mother findById(String entityI... | MotherRepository extends DrishtiRepository { public void closeAllCasesForEC(String ecCaseId) { List<Mother> mothers = findAllCasesForEC(ecCaseId); for (Mother mother : mothers) { close(mother.caseId()); } } void add(Mother mother); void switchToPNC(String caseId); List<Mother> allANCs(); Mother findById(String entityI... |
@Test public void testAddOrUpdateShouldAdd() { Location location = gson.fromJson(locationJson, Location.class); locationRepository.addOrUpdate(location); verify(sqLiteDatabase).replace(stringArgumentCaptor.capture(), stringArgumentCaptor.capture(), contentValuesArgumentCaptor.capture()); assertEquals(2, stringArgumentC... | public void addOrUpdate(Location location) { if (StringUtils.isBlank(location.getId())) throw new IllegalArgumentException("id not provided"); ContentValues contentValues = new ContentValues(); contentValues.put(ID, location.getId()); contentValues.put(UUID, location.getProperties().getUid()); contentValues.put(PARENT_... | LocationRepository extends BaseRepository { public void addOrUpdate(Location location) { if (StringUtils.isBlank(location.getId())) throw new IllegalArgumentException("id not provided"); ContentValues contentValues = new ContentValues(); contentValues.put(ID, location.getId()); contentValues.put(UUID, location.getPrope... | LocationRepository extends BaseRepository { public void addOrUpdate(Location location) { if (StringUtils.isBlank(location.getId())) throw new IllegalArgumentException("id not provided"); ContentValues contentValues = new ContentValues(); contentValues.put(ID, location.getId()); contentValues.put(UUID, location.getPrope... | LocationRepository extends BaseRepository { public void addOrUpdate(Location location) { if (StringUtils.isBlank(location.getId())) throw new IllegalArgumentException("id not provided"); ContentValues contentValues = new ContentValues(); contentValues.put(ID, location.getId()); contentValues.put(UUID, location.getPrope... | LocationRepository extends BaseRepository { public void addOrUpdate(Location location) { if (StringUtils.isBlank(location.getId())) throw new IllegalArgumentException("id not provided"); ContentValues contentValues = new ContentValues(); contentValues.put(ID, location.getId()); contentValues.put(UUID, location.getPrope... |
@Test public void testAddOrUpdateWithSyncStatus() { Location location = gson.fromJson(locationJson, Location.class); location.setSyncStatus(TYPE_Unsynced); locationRepository.addOrUpdate(location); verify(sqLiteDatabase).replace(stringArgumentCaptor.capture(), stringArgumentCaptor.capture(), contentValuesArgumentCaptor... | public void addOrUpdate(Location location) { if (StringUtils.isBlank(location.getId())) throw new IllegalArgumentException("id not provided"); ContentValues contentValues = new ContentValues(); contentValues.put(ID, location.getId()); contentValues.put(UUID, location.getProperties().getUid()); contentValues.put(PARENT_... | LocationRepository extends BaseRepository { public void addOrUpdate(Location location) { if (StringUtils.isBlank(location.getId())) throw new IllegalArgumentException("id not provided"); ContentValues contentValues = new ContentValues(); contentValues.put(ID, location.getId()); contentValues.put(UUID, location.getPrope... | LocationRepository extends BaseRepository { public void addOrUpdate(Location location) { if (StringUtils.isBlank(location.getId())) throw new IllegalArgumentException("id not provided"); ContentValues contentValues = new ContentValues(); contentValues.put(ID, location.getId()); contentValues.put(UUID, location.getPrope... | LocationRepository extends BaseRepository { public void addOrUpdate(Location location) { if (StringUtils.isBlank(location.getId())) throw new IllegalArgumentException("id not provided"); ContentValues contentValues = new ContentValues(); contentValues.put(ID, location.getId()); contentValues.put(UUID, location.getPrope... | LocationRepository extends BaseRepository { public void addOrUpdate(Location location) { if (StringUtils.isBlank(location.getId())) throw new IllegalArgumentException("id not provided"); ContentValues contentValues = new ContentValues(); contentValues.put(ID, location.getId()); contentValues.put(UUID, location.getPrope... |
@Test(expected = IllegalArgumentException.class) public void testAddOrUpdateShouldThrowException() { Location location = new Location(); locationRepository.addOrUpdate(location); } | public void addOrUpdate(Location location) { if (StringUtils.isBlank(location.getId())) throw new IllegalArgumentException("id not provided"); ContentValues contentValues = new ContentValues(); contentValues.put(ID, location.getId()); contentValues.put(UUID, location.getProperties().getUid()); contentValues.put(PARENT_... | LocationRepository extends BaseRepository { public void addOrUpdate(Location location) { if (StringUtils.isBlank(location.getId())) throw new IllegalArgumentException("id not provided"); ContentValues contentValues = new ContentValues(); contentValues.put(ID, location.getId()); contentValues.put(UUID, location.getPrope... | LocationRepository extends BaseRepository { public void addOrUpdate(Location location) { if (StringUtils.isBlank(location.getId())) throw new IllegalArgumentException("id not provided"); ContentValues contentValues = new ContentValues(); contentValues.put(ID, location.getId()); contentValues.put(UUID, location.getPrope... | LocationRepository extends BaseRepository { public void addOrUpdate(Location location) { if (StringUtils.isBlank(location.getId())) throw new IllegalArgumentException("id not provided"); ContentValues contentValues = new ContentValues(); contentValues.put(ID, location.getId()); contentValues.put(UUID, location.getPrope... | LocationRepository extends BaseRepository { public void addOrUpdate(Location location) { if (StringUtils.isBlank(location.getId())) throw new IllegalArgumentException("id not provided"); ContentValues contentValues = new ContentValues(); contentValues.put(ID, location.getId()); contentValues.put(UUID, location.getPrope... |
@Test public void assertfillSubFormaddresslatitudeAddslatitude() throws Exception { String addressJsonWithStartlatitudeString = "{\"entity_id\":\"mother\",\"value\":\"34.044494\",\"openmrs_entity\":\"person_address\"," + "\"openmrs_entity_id\":\"latitude\",\"hint\":\"address of household latitude\"," + "\"openmrs_entit... | public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bind == null || !bi... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... |
@Test public void tesGetAllLocations() { when(sqLiteDatabase.rawQuery("SELECT * FROM location", null)).thenReturn(getCursor()); List<Location> allLocations = locationRepository.getAllLocations(); verify(sqLiteDatabase).rawQuery(stringArgumentCaptor.capture(), argsCaptor.capture()); assertEquals("SELECT * FROM location"... | public List<Location> getAllLocations() { Cursor cursor = null; List<Location> locations = new ArrayList<>(); try { cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getLocationTableName(), null); while (cursor.moveToNext()) { locations.add(readCursor(cursor)); } cursor.close(); } catch (Exception e) { Timber.... | LocationRepository extends BaseRepository { public List<Location> getAllLocations() { Cursor cursor = null; List<Location> locations = new ArrayList<>(); try { cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getLocationTableName(), null); while (cursor.moveToNext()) { locations.add(readCursor(cursor)); } cur... | LocationRepository extends BaseRepository { public List<Location> getAllLocations() { Cursor cursor = null; List<Location> locations = new ArrayList<>(); try { cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getLocationTableName(), null); while (cursor.moveToNext()) { locations.add(readCursor(cursor)); } cur... | LocationRepository extends BaseRepository { public List<Location> getAllLocations() { Cursor cursor = null; List<Location> locations = new ArrayList<>(); try { cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getLocationTableName(), null); while (cursor.moveToNext()) { locations.add(readCursor(cursor)); } cur... | LocationRepository extends BaseRepository { public List<Location> getAllLocations() { Cursor cursor = null; List<Location> locations = new ArrayList<>(); try { cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getLocationTableName(), null); while (cursor.moveToNext()) { locations.add(readCursor(cursor)); } cur... |
@Test public void tesGetLocationsByParentId() { when(sqLiteDatabase.rawQuery("SELECT * FROM location WHERE parent_id =?", new String[]{"21"})).thenReturn(getCursor()); List<Location> allLocations = locationRepository.getLocationsByParentId("21"); verify(sqLiteDatabase).rawQuery(stringArgumentCaptor.capture(), argsCapto... | public List<Location> getLocationsByParentId(String parentId) { return getLocationsByParentId(parentId, getLocationTableName()); } | LocationRepository extends BaseRepository { public List<Location> getLocationsByParentId(String parentId) { return getLocationsByParentId(parentId, getLocationTableName()); } } | LocationRepository extends BaseRepository { public List<Location> getLocationsByParentId(String parentId) { return getLocationsByParentId(parentId, getLocationTableName()); } } | LocationRepository extends BaseRepository { public List<Location> getLocationsByParentId(String parentId) { return getLocationsByParentId(parentId, getLocationTableName()); } static void createTable(SQLiteDatabase database); void addOrUpdate(Location location); void deleteLocations(@NonNull Set<String> locationIdentif... | LocationRepository extends BaseRepository { public List<Location> getLocationsByParentId(String parentId) { return getLocationsByParentId(parentId, getLocationTableName()); } static void createTable(SQLiteDatabase database); void addOrUpdate(Location location); void deleteLocations(@NonNull Set<String> locationIdentif... |
@Test public void tesGetLocationById() { when(sqLiteDatabase.rawQuery("SELECT * FROM location WHERE _id =?", new String[]{"3734"})).thenReturn(getCursor()); Location location = locationRepository.getLocationById("3734"); verify(sqLiteDatabase).rawQuery(stringArgumentCaptor.capture(), argsCaptor.capture()); assertEquals... | public Location getLocationById(String id) { return getLocationById(id, getLocationTableName()); } | LocationRepository extends BaseRepository { public Location getLocationById(String id) { return getLocationById(id, getLocationTableName()); } } | LocationRepository extends BaseRepository { public Location getLocationById(String id) { return getLocationById(id, getLocationTableName()); } } | LocationRepository extends BaseRepository { public Location getLocationById(String id) { return getLocationById(id, getLocationTableName()); } static void createTable(SQLiteDatabase database); void addOrUpdate(Location location); void deleteLocations(@NonNull Set<String> locationIdentifiers); List<Location> getAllLoca... | LocationRepository extends BaseRepository { public Location getLocationById(String id) { return getLocationById(id, getLocationTableName()); } static void createTable(SQLiteDatabase database); void addOrUpdate(Location location); void deleteLocations(@NonNull Set<String> locationIdentifiers); List<Location> getAllLoca... |
@Test public void tesGetLocationByUUID() { when(sqLiteDatabase.rawQuery("SELECT * FROM location WHERE uuid =?", new String[]{"41587456-b7c8-4c4e-b433-23a786f742fc"})).thenReturn(getCursor()); Location location = locationRepository.getLocationByUUId("41587456-b7c8-4c4e-b433-23a786f742fc"); verify(sqLiteDatabase).rawQuer... | public Location getLocationByUUId(String uuid) { Cursor cursor = null; try { cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getLocationTableName() + " WHERE " + UUID + " =?", new String[]{uuid}); if (cursor.moveToFirst()) { return readCursor(cursor); } } catch (Exception e) { Timber.e(e); } finally { if (cu... | LocationRepository extends BaseRepository { public Location getLocationByUUId(String uuid) { Cursor cursor = null; try { cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getLocationTableName() + " WHERE " + UUID + " =?", new String[]{uuid}); if (cursor.moveToFirst()) { return readCursor(cursor); } } catch (Ex... | LocationRepository extends BaseRepository { public Location getLocationByUUId(String uuid) { Cursor cursor = null; try { cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getLocationTableName() + " WHERE " + UUID + " =?", new String[]{uuid}); if (cursor.moveToFirst()) { return readCursor(cursor); } } catch (Ex... | LocationRepository extends BaseRepository { public Location getLocationByUUId(String uuid) { Cursor cursor = null; try { cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getLocationTableName() + " WHERE " + UUID + " =?", new String[]{uuid}); if (cursor.moveToFirst()) { return readCursor(cursor); } } catch (Ex... | LocationRepository extends BaseRepository { public Location getLocationByUUId(String uuid) { Cursor cursor = null; try { cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getLocationTableName() + " WHERE " + UUID + " =?", new String[]{uuid}); if (cursor.moveToFirst()) { return readCursor(cursor); } } catch (Ex... |
@Test public void tesGetLocationByName() { when(sqLiteDatabase.rawQuery("SELECT * FROM location WHERE name =?", new String[]{"01_5"})).thenReturn(getCursor()); Location location = locationRepository.getLocationByName("01_5"); verify(sqLiteDatabase).rawQuery(stringArgumentCaptor.capture(), argsCaptor.capture()); assertE... | public Location getLocationByName(String name) { Cursor cursor = null; try { cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getLocationTableName() + " WHERE " + NAME + " =?", new String[]{name}); if (cursor.moveToFirst()) { return readCursor(cursor); } cursor.close(); } catch (Exception e) { Timber.e(e); } ... | LocationRepository extends BaseRepository { public Location getLocationByName(String name) { Cursor cursor = null; try { cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getLocationTableName() + " WHERE " + NAME + " =?", new String[]{name}); if (cursor.moveToFirst()) { return readCursor(cursor); } cursor.clos... | LocationRepository extends BaseRepository { public Location getLocationByName(String name) { Cursor cursor = null; try { cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getLocationTableName() + " WHERE " + NAME + " =?", new String[]{name}); if (cursor.moveToFirst()) { return readCursor(cursor); } cursor.clos... | LocationRepository extends BaseRepository { public Location getLocationByName(String name) { Cursor cursor = null; try { cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getLocationTableName() + " WHERE " + NAME + " =?", new String[]{name}); if (cursor.moveToFirst()) { return readCursor(cursor); } cursor.clos... | LocationRepository extends BaseRepository { public Location getLocationByName(String name) { Cursor cursor = null; try { cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getLocationTableName() + " WHERE " + NAME + " =?", new String[]{name}); if (cursor.moveToFirst()) { return readCursor(cursor); } cursor.clos... |
@Test public void tesGetLocationsByIds() { when(sqLiteDatabase.rawQuery("SELECT * FROM location WHERE _id IN (?)", new String[]{"3734"})).thenReturn(getCursor()); List<Location> locations = locationRepository.getLocationsByIds(Collections.singletonList("3734")); verify(sqLiteDatabase).rawQuery(stringArgumentCaptor.capt... | public List<Location> getLocationsByIds(List<String> ids) { return getLocationsByIds(ids, true); } | LocationRepository extends BaseRepository { public List<Location> getLocationsByIds(List<String> ids) { return getLocationsByIds(ids, true); } } | LocationRepository extends BaseRepository { public List<Location> getLocationsByIds(List<String> ids) { return getLocationsByIds(ids, true); } } | LocationRepository extends BaseRepository { public List<Location> getLocationsByIds(List<String> ids) { return getLocationsByIds(ids, true); } static void createTable(SQLiteDatabase database); void addOrUpdate(Location location); void deleteLocations(@NonNull Set<String> locationIdentifiers); List<Location> getAllLoca... | LocationRepository extends BaseRepository { public List<Location> getLocationsByIds(List<String> ids) { return getLocationsByIds(ids, true); } static void createTable(SQLiteDatabase database); void addOrUpdate(Location location); void deleteLocations(@NonNull Set<String> locationIdentifiers); List<Location> getAllLoca... |
@Test public void tesGetLocationsByIdsExclusive() { when(sqLiteDatabase.rawQuery("SELECT * FROM location WHERE _id NOT IN (?)", new Object[]{"3734"})).thenReturn(getCursor()); List<Location> locations = locationRepository.getLocationsByIds(Collections.singletonList("3734"), false); verify(sqLiteDatabase).rawQuery(strin... | public List<Location> getLocationsByIds(List<String> ids) { return getLocationsByIds(ids, true); } | LocationRepository extends BaseRepository { public List<Location> getLocationsByIds(List<String> ids) { return getLocationsByIds(ids, true); } } | LocationRepository extends BaseRepository { public List<Location> getLocationsByIds(List<String> ids) { return getLocationsByIds(ids, true); } } | LocationRepository extends BaseRepository { public List<Location> getLocationsByIds(List<String> ids) { return getLocationsByIds(ids, true); } static void createTable(SQLiteDatabase database); void addOrUpdate(Location location); void deleteLocations(@NonNull Set<String> locationIdentifiers); List<Location> getAllLoca... | LocationRepository extends BaseRepository { public List<Location> getLocationsByIds(List<String> ids) { return getLocationsByIds(ids, true); } static void createTable(SQLiteDatabase database); void addOrUpdate(Location location); void deleteLocations(@NonNull Set<String> locationIdentifiers); List<Location> getAllLoca... |
@Test public void testGetLocationsByTagName() { when(sqLiteDatabase.rawQuery("SELECT * FROM location_tag WHERE name =?", new String[]{"Facility"})).thenReturn(getLocationTagsCursor()); when(sqLiteDatabase.rawQuery("SELECT * FROM location WHERE _id IN (?)", new String[]{"1"})).thenReturn(getCursor()); List<Location> tag... | public List<Location> getLocationsByTagName(String tagName) { LocationTagRepository locationTagRepository = new LocationTagRepository(); List<LocationTag> locationTags = locationTagRepository.getLocationTagsByTagName(tagName); List<String> locationIds = locationTags.stream() .map(LocationTag::getLocationId) .collect(Co... | LocationRepository extends BaseRepository { public List<Location> getLocationsByTagName(String tagName) { LocationTagRepository locationTagRepository = new LocationTagRepository(); List<LocationTag> locationTags = locationTagRepository.getLocationTagsByTagName(tagName); List<String> locationIds = locationTags.stream() ... | LocationRepository extends BaseRepository { public List<Location> getLocationsByTagName(String tagName) { LocationTagRepository locationTagRepository = new LocationTagRepository(); List<LocationTag> locationTags = locationTagRepository.getLocationTagsByTagName(tagName); List<String> locationIds = locationTags.stream() ... | LocationRepository extends BaseRepository { public List<Location> getLocationsByTagName(String tagName) { LocationTagRepository locationTagRepository = new LocationTagRepository(); List<LocationTag> locationTags = locationTagRepository.getLocationTagsByTagName(tagName); List<String> locationIds = locationTags.stream() ... | LocationRepository extends BaseRepository { public List<Location> getLocationsByTagName(String tagName) { LocationTagRepository locationTagRepository = new LocationTagRepository(); List<LocationTag> locationTags = locationTagRepository.getLocationTagsByTagName(tagName); List<String> locationIds = locationTags.stream() ... |
@Test public void testAddOrUpdateShouldAdd() { Manifest manifest = gson.fromJson(manifestJson, Manifest.class); manifestRepository.addOrUpdate(manifest); verify(sqLiteDatabase).replace(stringArgumentCaptor.capture(), stringArgumentCaptor.capture(), contentValuesArgumentCaptor.capture()); assertEquals(2, stringArgumentC... | public void addOrUpdate(Manifest manifest) { ContentValues contentValues = new ContentValues(); if (manifest.getId() != null) contentValues.put(ID, manifest.getId()); contentValues.put(VERSION, manifest.getVersion()); contentValues.put(APP_VERSION, manifest.getAppVersion()); contentValues.put(FORM_VERSION, manifest.get... | ManifestRepository extends BaseRepository { public void addOrUpdate(Manifest manifest) { ContentValues contentValues = new ContentValues(); if (manifest.getId() != null) contentValues.put(ID, manifest.getId()); contentValues.put(VERSION, manifest.getVersion()); contentValues.put(APP_VERSION, manifest.getAppVersion()); ... | ManifestRepository extends BaseRepository { public void addOrUpdate(Manifest manifest) { ContentValues contentValues = new ContentValues(); if (manifest.getId() != null) contentValues.put(ID, manifest.getId()); contentValues.put(VERSION, manifest.getVersion()); contentValues.put(APP_VERSION, manifest.getAppVersion()); ... | ManifestRepository extends BaseRepository { public void addOrUpdate(Manifest manifest) { ContentValues contentValues = new ContentValues(); if (manifest.getId() != null) contentValues.put(ID, manifest.getId()); contentValues.put(VERSION, manifest.getVersion()); contentValues.put(APP_VERSION, manifest.getAppVersion()); ... | ManifestRepository extends BaseRepository { public void addOrUpdate(Manifest manifest) { ContentValues contentValues = new ContentValues(); if (manifest.getId() != null) contentValues.put(ID, manifest.getId()); contentValues.put(VERSION, manifest.getVersion()); contentValues.put(APP_VERSION, manifest.getAppVersion()); ... |
@Test public void testGetAllManifests() { when(sqLiteDatabase.rawQuery("SELECT * FROM " + MANIFEST_TABLE + " ORDER BY " + CREATED_AT + " DESC ", null)).thenReturn(getCursor()); List<Manifest> manifests = manifestRepository.getAllManifests(); verify(sqLiteDatabase).rawQuery(stringArgumentCaptor.capture(), argsCaptor.cap... | public List<Manifest> getAllManifests() { List<Manifest> manifests = new ArrayList<>(); try (Cursor cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getManifestTableName() + " ORDER BY " + CREATED_AT + " DESC ", null)) { while (cursor.moveToNext()) { manifests.add(readCursor(cursor)); } } catch (Exception e) ... | ManifestRepository extends BaseRepository { public List<Manifest> getAllManifests() { List<Manifest> manifests = new ArrayList<>(); try (Cursor cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getManifestTableName() + " ORDER BY " + CREATED_AT + " DESC ", null)) { while (cursor.moveToNext()) { manifests.add(r... | ManifestRepository extends BaseRepository { public List<Manifest> getAllManifests() { List<Manifest> manifests = new ArrayList<>(); try (Cursor cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getManifestTableName() + " ORDER BY " + CREATED_AT + " DESC ", null)) { while (cursor.moveToNext()) { manifests.add(r... | ManifestRepository extends BaseRepository { public List<Manifest> getAllManifests() { List<Manifest> manifests = new ArrayList<>(); try (Cursor cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getManifestTableName() + " ORDER BY " + CREATED_AT + " DESC ", null)) { while (cursor.moveToNext()) { manifests.add(r... | ManifestRepository extends BaseRepository { public List<Manifest> getAllManifests() { List<Manifest> manifests = new ArrayList<>(); try (Cursor cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getManifestTableName() + " ORDER BY " + CREATED_AT + " DESC ", null)) { while (cursor.moveToNext()) { manifests.add(r... |
@Test public void assertfillSubFormaddressGeopointAddsGeopoint() throws Exception { String addressJsonWithGeopointString = "{\"entity_id\":\"mother\",\"value\":\"34.044494 -84.695704 4 76 = lat lon alt prec\"," + "\"openmrs_entity\":\"person_address\",\"openmrs_entity_id\":\"geopoint\",\"hint\":\"address of " + "househ... | public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bind == null || !bi... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... |
@Test public void testGetManifestByAppVersion() { String appVersion = "1.1.0"; when(sqLiteDatabase.rawQuery("SELECT * FROM " + MANIFEST_TABLE + " WHERE " + APP_VERSION + " =?", new String[]{appVersion})).thenReturn(getCursor()); List<Manifest> manifests = manifestRepository.getManifestByAppVersion(appVersion); verify(s... | public List<Manifest> getManifestByAppVersion(String appVersion) { List<Manifest> manifests = new ArrayList<>(); try (Cursor cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getManifestTableName() + " WHERE " + APP_VERSION + " =?", new String[]{appVersion})) { while (cursor.moveToNext()) { manifests.add(readC... | ManifestRepository extends BaseRepository { public List<Manifest> getManifestByAppVersion(String appVersion) { List<Manifest> manifests = new ArrayList<>(); try (Cursor cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getManifestTableName() + " WHERE " + APP_VERSION + " =?", new String[]{appVersion})) { while... | ManifestRepository extends BaseRepository { public List<Manifest> getManifestByAppVersion(String appVersion) { List<Manifest> manifests = new ArrayList<>(); try (Cursor cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getManifestTableName() + " WHERE " + APP_VERSION + " =?", new String[]{appVersion})) { while... | ManifestRepository extends BaseRepository { public List<Manifest> getManifestByAppVersion(String appVersion) { List<Manifest> manifests = new ArrayList<>(); try (Cursor cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getManifestTableName() + " WHERE " + APP_VERSION + " =?", new String[]{appVersion})) { while... | ManifestRepository extends BaseRepository { public List<Manifest> getManifestByAppVersion(String appVersion) { List<Manifest> manifests = new ArrayList<>(); try (Cursor cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getManifestTableName() + " WHERE " + APP_VERSION + " =?", new String[]{appVersion})) { while... |
@Test public void testGetActiveManifest() { when(sqLiteDatabase.rawQuery("SELECT * FROM " + MANIFEST_TABLE + " WHERE " + ACTIVE + " =?", new String[]{"1"})).thenReturn(getCursor()); Manifest manifest = manifestRepository.getActiveManifest(); verify(sqLiteDatabase).rawQuery(stringArgumentCaptor.capture(), argsCaptor.cap... | public Manifest getActiveManifest() { try (Cursor cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getManifestTableName() + " WHERE " + ACTIVE + " =?", new String[]{"1"})) { if (cursor.moveToFirst()) { return readCursor(cursor); } } catch (Exception e) { Timber.e(e); } return null; } | ManifestRepository extends BaseRepository { public Manifest getActiveManifest() { try (Cursor cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getManifestTableName() + " WHERE " + ACTIVE + " =?", new String[]{"1"})) { if (cursor.moveToFirst()) { return readCursor(cursor); } } catch (Exception e) { Timber.e(e)... | ManifestRepository extends BaseRepository { public Manifest getActiveManifest() { try (Cursor cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getManifestTableName() + " WHERE " + ACTIVE + " =?", new String[]{"1"})) { if (cursor.moveToFirst()) { return readCursor(cursor); } } catch (Exception e) { Timber.e(e)... | ManifestRepository extends BaseRepository { public Manifest getActiveManifest() { try (Cursor cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getManifestTableName() + " WHERE " + ACTIVE + " =?", new String[]{"1"})) { if (cursor.moveToFirst()) { return readCursor(cursor); } } catch (Exception e) { Timber.e(e)... | ManifestRepository extends BaseRepository { public Manifest getActiveManifest() { try (Cursor cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getManifestTableName() + " WHERE " + ACTIVE + " =?", new String[]{"1"})) { if (cursor.moveToFirst()) { return readCursor(cursor); } } catch (Exception e) { Timber.e(e)... |
@Test public void assertGetUnSyncedReportsReturnsList() { when(sqliteDatabase.rawQuery(anyString(), any(String[].class))).thenReturn(getCursorSyncStatus()); assertNotNull(hia2ReportRepository.getUnSyncedReports(1)); } | public List<JSONObject> getUnSyncedReports(int limit) { List<JSONObject> reports = new ArrayList<JSONObject>(); String query = "select " + report_column.json + "," + report_column.syncStatus + " from " + Table.hia2_report.name() + " where " + report_column.syncStatus + " = ? and length(" + report_column.json + ")>2 ord... | Hia2ReportRepository extends BaseRepository { public List<JSONObject> getUnSyncedReports(int limit) { List<JSONObject> reports = new ArrayList<JSONObject>(); String query = "select " + report_column.json + "," + report_column.syncStatus + " from " + Table.hia2_report.name() + " where " + report_column.syncStatus + " = ... | Hia2ReportRepository extends BaseRepository { public List<JSONObject> getUnSyncedReports(int limit) { List<JSONObject> reports = new ArrayList<JSONObject>(); String query = "select " + report_column.json + "," + report_column.syncStatus + " from " + Table.hia2_report.name() + " where " + report_column.syncStatus + " = ... | Hia2ReportRepository extends BaseRepository { public List<JSONObject> getUnSyncedReports(int limit) { List<JSONObject> reports = new ArrayList<JSONObject>(); String query = "select " + report_column.json + "," + report_column.syncStatus + " from " + Table.hia2_report.name() + " where " + report_column.syncStatus + " = ... | Hia2ReportRepository extends BaseRepository { public List<JSONObject> getUnSyncedReports(int limit) { List<JSONObject> reports = new ArrayList<JSONObject>(); String query = "select " + report_column.json + "," + report_column.syncStatus + " from " + Table.hia2_report.name() + " where " + report_column.syncStatus + " = ... |
@Test public void assertGetUnValidatedReportFormSubmissionIdsReturnsList() { when(sqliteDatabase.rawQuery(anyString(), any(String[].class))).thenReturn(getCursorSyncStatus()); assertNotNull(hia2ReportRepository.getUnValidatedReportFormSubmissionIds(1)); } | public List<String> getUnValidatedReportFormSubmissionIds(int limit) { List<String> ids = new ArrayList<String>(); final String validateFilter = " where " + report_column.syncStatus + " = ? " + " AND ( " + report_column.validationStatus + " is NULL or " + report_column.validationStatus + " != ? ) "; String query = "sel... | Hia2ReportRepository extends BaseRepository { public List<String> getUnValidatedReportFormSubmissionIds(int limit) { List<String> ids = new ArrayList<String>(); final String validateFilter = " where " + report_column.syncStatus + " = ? " + " AND ( " + report_column.validationStatus + " is NULL or " + report_column.vali... | Hia2ReportRepository extends BaseRepository { public List<String> getUnValidatedReportFormSubmissionIds(int limit) { List<String> ids = new ArrayList<String>(); final String validateFilter = " where " + report_column.syncStatus + " = ? " + " AND ( " + report_column.validationStatus + " is NULL or " + report_column.vali... | Hia2ReportRepository extends BaseRepository { public List<String> getUnValidatedReportFormSubmissionIds(int limit) { List<String> ids = new ArrayList<String>(); final String validateFilter = " where " + report_column.syncStatus + " = ? " + " AND ( " + report_column.validationStatus + " is NULL or " + report_column.vali... | Hia2ReportRepository extends BaseRepository { public List<String> getUnValidatedReportFormSubmissionIds(int limit) { List<String> ids = new ArrayList<String>(); final String validateFilter = " where " + report_column.syncStatus + " = ? " + " AND ( " + report_column.validationStatus + " is NULL or " + report_column.vali... |
@Test public void assertAddReportCallsDatabaseInsertAndUpdate() throws Exception { String jsonReport = "{\"reportType\":\"reportType\", \"formSubmissionId\":\"formSubmissionId\"}"; when(sqliteDatabase.rawQuery(anyString(), any(String[].class))).thenReturn(getCursorSyncStatus()); hia2ReportRepository.addReport(new JSONO... | public void addReport(JSONObject jsonObject) { try { ContentValues values = new ContentValues(); values.put(report_column.json.name(), jsonObject.toString()); values.put(report_column.reportType.name(), jsonObject.has(report_column.reportType.name()) ? jsonObject.getString( report_column.reportType.name()) : ""); value... | Hia2ReportRepository extends BaseRepository { public void addReport(JSONObject jsonObject) { try { ContentValues values = new ContentValues(); values.put(report_column.json.name(), jsonObject.toString()); values.put(report_column.reportType.name(), jsonObject.has(report_column.reportType.name()) ? jsonObject.getString(... | Hia2ReportRepository extends BaseRepository { public void addReport(JSONObject jsonObject) { try { ContentValues values = new ContentValues(); values.put(report_column.json.name(), jsonObject.toString()); values.put(report_column.reportType.name(), jsonObject.has(report_column.reportType.name()) ? jsonObject.getString(... | Hia2ReportRepository extends BaseRepository { public void addReport(JSONObject jsonObject) { try { ContentValues values = new ContentValues(); values.put(report_column.json.name(), jsonObject.toString()); values.put(report_column.reportType.name(), jsonObject.has(report_column.reportType.name()) ? jsonObject.getString(... | Hia2ReportRepository extends BaseRepository { public void addReport(JSONObject jsonObject) { try { ContentValues values = new ContentValues(); values.put(report_column.json.name(), jsonObject.toString()); values.put(report_column.reportType.name(), jsonObject.has(report_column.reportType.name()) ? jsonObject.getString(... |
@Test public void assertmarkReportsAsSyncedCallsDatabaseUpdate() throws Exception { String jsonReport = "{\"reportType\":\"reportType\", \"formSubmissionId\":\"formSubmissionId\"}"; List<JSONObject> reports = new ArrayList<>(); reports.add(new JSONObject(jsonReport)); hia2ReportRepository.markReportsAsSynced(reports); ... | public void markReportsAsSynced(List<JSONObject> syncedReports) { try { if (syncedReports != null && !syncedReports.isEmpty()) { for (JSONObject report : syncedReports) { String formSubmissionId = report.getString(report_column.formSubmissionId .name()); markReportAsSynced(formSubmissionId); } } } catch (Exception e) {... | Hia2ReportRepository extends BaseRepository { public void markReportsAsSynced(List<JSONObject> syncedReports) { try { if (syncedReports != null && !syncedReports.isEmpty()) { for (JSONObject report : syncedReports) { String formSubmissionId = report.getString(report_column.formSubmissionId .name()); markReportAsSynced(... | Hia2ReportRepository extends BaseRepository { public void markReportsAsSynced(List<JSONObject> syncedReports) { try { if (syncedReports != null && !syncedReports.isEmpty()) { for (JSONObject report : syncedReports) { String formSubmissionId = report.getString(report_column.formSubmissionId .name()); markReportAsSynced(... | Hia2ReportRepository extends BaseRepository { public void markReportsAsSynced(List<JSONObject> syncedReports) { try { if (syncedReports != null && !syncedReports.isEmpty()) { for (JSONObject report : syncedReports) { String formSubmissionId = report.getString(report_column.formSubmissionId .name()); markReportAsSynced(... | Hia2ReportRepository extends BaseRepository { public void markReportsAsSynced(List<JSONObject> syncedReports) { try { if (syncedReports != null && !syncedReports.isEmpty()) { for (JSONObject report : syncedReports) { String formSubmissionId = report.getString(report_column.formSubmissionId .name()); markReportAsSynced(... |
@Test public void assertOnCreateCallsDatabaseExec() { detailsRepository.onCreate(sqLiteDatabase); Mockito.verify(sqLiteDatabase, Mockito.times(1)).execSQL(Mockito.anyString()); } | @Override protected void onCreate(SQLiteDatabase database) { database.execSQL(SQL); } | DetailsRepository extends DrishtiRepository { @Override protected void onCreate(SQLiteDatabase database) { database.execSQL(SQL); } } | DetailsRepository extends DrishtiRepository { @Override protected void onCreate(SQLiteDatabase database) { database.execSQL(SQL); } } | DetailsRepository extends DrishtiRepository { @Override protected void onCreate(SQLiteDatabase database) { database.execSQL(SQL); } void add(String baseEntityId, String key, String value, Long timestamp); Map<String, String> getAllDetailsForClient(String baseEntityId); Map<String, String> updateDetails(CommonPersonObj... | DetailsRepository extends DrishtiRepository { @Override protected void onCreate(SQLiteDatabase database) { database.execSQL(SQL); } void add(String baseEntityId, String key, String value, Long timestamp); Map<String, String> getAllDetailsForClient(String baseEntityId); Map<String, String> updateDetails(CommonPersonObj... |
@Test public void assertAddCallsRawQueryAndInsertUpdate() { detailsRepository.add("1", "key", "value", new Long(0)); Mockito.verify(sqLiteDatabase, Mockito.times(1)).rawQuery(Mockito.anyString(), Mockito.any(String[].class)); detailsRepository.add("1", "key", "xyz", new Long(0)); Mockito.verify(sqLiteDatabase, Mockito.... | public void add(String baseEntityId, String key, String value, Long timestamp) { SQLiteDatabase database = masterRepository.getWritableDatabase(); Boolean exists = getIdForDetailsIfExists(baseEntityId, key, value); if (exists == null) { return; } ContentValues values = new ContentValues(); values.put(BASE_ENTITY_ID_COL... | DetailsRepository extends DrishtiRepository { public void add(String baseEntityId, String key, String value, Long timestamp) { SQLiteDatabase database = masterRepository.getWritableDatabase(); Boolean exists = getIdForDetailsIfExists(baseEntityId, key, value); if (exists == null) { return; } ContentValues values = new ... | DetailsRepository extends DrishtiRepository { public void add(String baseEntityId, String key, String value, Long timestamp) { SQLiteDatabase database = masterRepository.getWritableDatabase(); Boolean exists = getIdForDetailsIfExists(baseEntityId, key, value); if (exists == null) { return; } ContentValues values = new ... | DetailsRepository extends DrishtiRepository { public void add(String baseEntityId, String key, String value, Long timestamp) { SQLiteDatabase database = masterRepository.getWritableDatabase(); Boolean exists = getIdForDetailsIfExists(baseEntityId, key, value); if (exists == null) { return; } ContentValues values = new ... | DetailsRepository extends DrishtiRepository { public void add(String baseEntityId, String key, String value, Long timestamp) { SQLiteDatabase database = masterRepository.getWritableDatabase(); Boolean exists = getIdForDetailsIfExists(baseEntityId, key, value); if (exists == null) { return; } ContentValues values = new ... |
@Test public void assertgetAllDetailsForClient() { Map<String, String> detail = detailsRepository.getAllDetailsForClient("1"); Assert.assertNotNull(detail); Assert.assertEquals(detail.get("key"), "value"); } | public Map<String, String> getAllDetailsForClient(String baseEntityId) { Cursor cursor = null; Map<String, String> clientDetails = new HashMap<String, String>(); try { SQLiteDatabase db = masterRepository.getReadableDatabase(); String query = "SELECT * FROM " + TABLE_NAME + " WHERE " + BASE_ENTITY_ID_COLUMN + " =?"; cu... | DetailsRepository extends DrishtiRepository { public Map<String, String> getAllDetailsForClient(String baseEntityId) { Cursor cursor = null; Map<String, String> clientDetails = new HashMap<String, String>(); try { SQLiteDatabase db = masterRepository.getReadableDatabase(); String query = "SELECT * FROM " + TABLE_NAME +... | DetailsRepository extends DrishtiRepository { public Map<String, String> getAllDetailsForClient(String baseEntityId) { Cursor cursor = null; Map<String, String> clientDetails = new HashMap<String, String>(); try { SQLiteDatabase db = masterRepository.getReadableDatabase(); String query = "SELECT * FROM " + TABLE_NAME +... | DetailsRepository extends DrishtiRepository { public Map<String, String> getAllDetailsForClient(String baseEntityId) { Cursor cursor = null; Map<String, String> clientDetails = new HashMap<String, String>(); try { SQLiteDatabase db = masterRepository.getReadableDatabase(); String query = "SELECT * FROM " + TABLE_NAME +... | DetailsRepository extends DrishtiRepository { public Map<String, String> getAllDetailsForClient(String baseEntityId) { Cursor cursor = null; Map<String, String> clientDetails = new HashMap<String, String>(); try { SQLiteDatabase db = masterRepository.getReadableDatabase(); String query = "SELECT * FROM " + TABLE_NAME +... |
@Test public void assertupdateDetails() { Assert.assertNotNull(detailsRepository.updateDetails(Mockito.mock(CommonPersonObject.class))); } | public Map<String, String> updateDetails(CommonPersonObjectClient commonPersonObjectClient) { Map<String, String> details = getAllDetailsForClient(commonPersonObjectClient.entityId()); details.putAll(commonPersonObjectClient.getColumnmaps()); if (commonPersonObjectClient.getDetails() != null) { commonPersonObjectClient... | DetailsRepository extends DrishtiRepository { public Map<String, String> updateDetails(CommonPersonObjectClient commonPersonObjectClient) { Map<String, String> details = getAllDetailsForClient(commonPersonObjectClient.entityId()); details.putAll(commonPersonObjectClient.getColumnmaps()); if (commonPersonObjectClient.ge... | DetailsRepository extends DrishtiRepository { public Map<String, String> updateDetails(CommonPersonObjectClient commonPersonObjectClient) { Map<String, String> details = getAllDetailsForClient(commonPersonObjectClient.entityId()); details.putAll(commonPersonObjectClient.getColumnmaps()); if (commonPersonObjectClient.ge... | DetailsRepository extends DrishtiRepository { public Map<String, String> updateDetails(CommonPersonObjectClient commonPersonObjectClient) { Map<String, String> details = getAllDetailsForClient(commonPersonObjectClient.entityId()); details.putAll(commonPersonObjectClient.getColumnmaps()); if (commonPersonObjectClient.ge... | DetailsRepository extends DrishtiRepository { public Map<String, String> updateDetails(CommonPersonObjectClient commonPersonObjectClient) { Map<String, String> details = getAllDetailsForClient(commonPersonObjectClient.entityId()); details.putAll(commonPersonObjectClient.getColumnmaps()); if (commonPersonObjectClient.ge... |
@Test public void assertfillSubFormaddressPostal_codeAddsPostal_code() throws Exception { String addressJsonWithStartPostal_code = "{\"entity_id\":\"mother\",\"value\":\"4021\",\"openmrs_entity\":\"person_address\"," + "\"openmrs_entity_id\":\"postal_code\",\"hint\":\"address of household postal_code\"," + "\"openmrs_e... | public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bind == null || !bi... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... |
@Test public void assertInValidUrlFails() { Assert.assertFalse(UrlUtil.isValidUrl("invalid.org")); Assert.assertFalse(UrlUtil.isValidUrl("error.test")); } | public static boolean isValidUrl(String s){ return new UrlValidator(new String[]{"http", "https"}).isValid(s); } | UrlUtil { public static boolean isValidUrl(String s){ return new UrlValidator(new String[]{"http", "https"}).isValid(s); } } | UrlUtil { public static boolean isValidUrl(String s){ return new UrlValidator(new String[]{"http", "https"}).isValid(s); } } | UrlUtil { public static boolean isValidUrl(String s){ return new UrlValidator(new String[]{"http", "https"}).isValid(s); } static boolean isValidUrl(String s); } | UrlUtil { public static boolean isValidUrl(String s){ return new UrlValidator(new String[]{"http", "https"}).isValid(s); } static boolean isValidUrl(String s); } |
@Test public void assertupdateDetails2() { Assert.assertNotNull(detailsRepository.updateDetails(Mockito.mock(CommonPersonObjectClient.class))); } | public Map<String, String> updateDetails(CommonPersonObjectClient commonPersonObjectClient) { Map<String, String> details = getAllDetailsForClient(commonPersonObjectClient.entityId()); details.putAll(commonPersonObjectClient.getColumnmaps()); if (commonPersonObjectClient.getDetails() != null) { commonPersonObjectClient... | DetailsRepository extends DrishtiRepository { public Map<String, String> updateDetails(CommonPersonObjectClient commonPersonObjectClient) { Map<String, String> details = getAllDetailsForClient(commonPersonObjectClient.entityId()); details.putAll(commonPersonObjectClient.getColumnmaps()); if (commonPersonObjectClient.ge... | DetailsRepository extends DrishtiRepository { public Map<String, String> updateDetails(CommonPersonObjectClient commonPersonObjectClient) { Map<String, String> details = getAllDetailsForClient(commonPersonObjectClient.entityId()); details.putAll(commonPersonObjectClient.getColumnmaps()); if (commonPersonObjectClient.ge... | DetailsRepository extends DrishtiRepository { public Map<String, String> updateDetails(CommonPersonObjectClient commonPersonObjectClient) { Map<String, String> details = getAllDetailsForClient(commonPersonObjectClient.entityId()); details.putAll(commonPersonObjectClient.getColumnmaps()); if (commonPersonObjectClient.ge... | DetailsRepository extends DrishtiRepository { public Map<String, String> updateDetails(CommonPersonObjectClient commonPersonObjectClient) { Map<String, String> details = getAllDetailsForClient(commonPersonObjectClient.entityId()); details.putAll(commonPersonObjectClient.getColumnmaps()); if (commonPersonObjectClient.ge... |
@Test public void assertdeleteDetails() { Assert.assertEquals(detailsRepository.deleteDetails("1"), false); Mockito.when(sqLiteDatabase.delete(Mockito.anyString(), Mockito.anyString(), Mockito.any(String[].class))).thenReturn(1); Assert.assertEquals(detailsRepository.deleteDetails("1"), true); } | public boolean deleteDetails(String baseEntityId) { try { SQLiteDatabase db = masterRepository.getWritableDatabase(); int afftectedRows = db .delete(TABLE_NAME, BASE_ENTITY_ID_COLUMN + " = ?", new String[]{baseEntityId}); if (afftectedRows > 0) { return true; } } catch (Exception e) { Timber.e(e); } return false; } | DetailsRepository extends DrishtiRepository { public boolean deleteDetails(String baseEntityId) { try { SQLiteDatabase db = masterRepository.getWritableDatabase(); int afftectedRows = db .delete(TABLE_NAME, BASE_ENTITY_ID_COLUMN + " = ?", new String[]{baseEntityId}); if (afftectedRows > 0) { return true; } } catch (Exc... | DetailsRepository extends DrishtiRepository { public boolean deleteDetails(String baseEntityId) { try { SQLiteDatabase db = masterRepository.getWritableDatabase(); int afftectedRows = db .delete(TABLE_NAME, BASE_ENTITY_ID_COLUMN + " = ?", new String[]{baseEntityId}); if (afftectedRows > 0) { return true; } } catch (Exc... | DetailsRepository extends DrishtiRepository { public boolean deleteDetails(String baseEntityId) { try { SQLiteDatabase db = masterRepository.getWritableDatabase(); int afftectedRows = db .delete(TABLE_NAME, BASE_ENTITY_ID_COLUMN + " = ?", new String[]{baseEntityId}); if (afftectedRows > 0) { return true; } } catch (Exc... | DetailsRepository extends DrishtiRepository { public boolean deleteDetails(String baseEntityId) { try { SQLiteDatabase db = masterRepository.getWritableDatabase(); int afftectedRows = db .delete(TABLE_NAME, BASE_ENTITY_ID_COLUMN + " = ?", new String[]{baseEntityId}); if (afftectedRows > 0) { return true; } } catch (Exc... |
@Test public void assertFindMotherWithOpenStatus() { Mockito.when(motherRepository.findOpenCaseByCaseID(Mockito.anyString())).thenReturn(Mockito.mock(Mother.class)); Assert.assertNotNull(allBeneficiaries.findMotherWithOpenStatus("")); } | public Mother findMotherWithOpenStatus(String caseId) { return motherRepository.findOpenCaseByCaseID(caseId); } | AllBeneficiaries { public Mother findMotherWithOpenStatus(String caseId) { return motherRepository.findOpenCaseByCaseID(caseId); } } | AllBeneficiaries { public Mother findMotherWithOpenStatus(String caseId) { return motherRepository.findOpenCaseByCaseID(caseId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
... | AllBeneficiaries { public Mother findMotherWithOpenStatus(String caseId) { return motherRepository.findOpenCaseByCaseID(caseId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
... | AllBeneficiaries { public Mother findMotherWithOpenStatus(String caseId) { return motherRepository.findOpenCaseByCaseID(caseId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
... |
@Test public void assertFindMotherReturnsMother() { Mockito.when(motherRepository.findByCaseIds(Mockito.anyString())).thenReturn(new ArrayList<Mother>()); Assert.assertNull(allBeneficiaries.findMother("")); List<Mother> list = new ArrayList<Mother>(); list.add(Mockito.mock(Mother.class)); Mockito.when(motherRepository.... | public Mother findMother(String caseId) { List<Mother> mothers = motherRepository.findByCaseIds(caseId); if (mothers.isEmpty()) { return null; } return mothers.get(0); } | AllBeneficiaries { public Mother findMother(String caseId) { List<Mother> mothers = motherRepository.findByCaseIds(caseId); if (mothers.isEmpty()) { return null; } return mothers.get(0); } } | AllBeneficiaries { public Mother findMother(String caseId) { List<Mother> mothers = motherRepository.findByCaseIds(caseId); if (mothers.isEmpty()) { return null; } return mothers.get(0); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository al... | AllBeneficiaries { public Mother findMother(String caseId) { List<Mother> mothers = motherRepository.findByCaseIds(caseId); if (mothers.isEmpty()) { return null; } return mothers.get(0); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository al... | AllBeneficiaries { public Mother findMother(String caseId) { List<Mother> mothers = motherRepository.findByCaseIds(caseId); if (mothers.isEmpty()) { return null; } return mothers.get(0); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository al... |
@Test public void assertFindMotherByECCaseIdReturnsMother() { Mockito.when(motherRepository.findAllCasesForEC(Mockito.anyString())).thenReturn(new ArrayList<Mother>()); Assert.assertNull(allBeneficiaries.findMotherByECCaseId("")); List<Mother> list = new ArrayList<Mother>(); list.add(Mockito.mock(Mother.class)); Mockit... | public Mother findMotherByECCaseId(String ecCaseId) { List<Mother> mothers = motherRepository.findAllCasesForEC(ecCaseId); if (mothers.isEmpty()) { return null; } return mothers.get(0); } | AllBeneficiaries { public Mother findMotherByECCaseId(String ecCaseId) { List<Mother> mothers = motherRepository.findAllCasesForEC(ecCaseId); if (mothers.isEmpty()) { return null; } return mothers.get(0); } } | AllBeneficiaries { public Mother findMotherByECCaseId(String ecCaseId) { List<Mother> mothers = motherRepository.findAllCasesForEC(ecCaseId); if (mothers.isEmpty()) { return null; } return mothers.get(0); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
... | AllBeneficiaries { public Mother findMotherByECCaseId(String ecCaseId) { List<Mother> mothers = motherRepository.findAllCasesForEC(ecCaseId); if (mothers.isEmpty()) { return null; } return mothers.get(0); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
... | AllBeneficiaries { public Mother findMotherByECCaseId(String ecCaseId) { List<Mother> mothers = motherRepository.findAllCasesForEC(ecCaseId); if (mothers.isEmpty()) { return null; } return mothers.get(0); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
... |
@Test public void assertFindAllChildrenByCaseIDs() { Mockito.when(childRepository.findChildrenByCaseIds(Mockito.any(String[].class))).thenReturn(Mockito.mock(List.class)); Assert.assertNotNull(allBeneficiaries.findAllChildrenByCaseIDs(new ArrayList<String>())); } | public List<Child> findAllChildrenByCaseIDs(List<String> caseIds) { return childRepository.findChildrenByCaseIds(caseIds.toArray(new String[caseIds.size()])); } | AllBeneficiaries { public List<Child> findAllChildrenByCaseIDs(List<String> caseIds) { return childRepository.findChildrenByCaseIds(caseIds.toArray(new String[caseIds.size()])); } } | AllBeneficiaries { public List<Child> findAllChildrenByCaseIDs(List<String> caseIds) { return childRepository.findChildrenByCaseIds(caseIds.toArray(new String[caseIds.size()])); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertReposi... | AllBeneficiaries { public List<Child> findAllChildrenByCaseIDs(List<String> caseIds) { return childRepository.findChildrenByCaseIds(caseIds.toArray(new String[caseIds.size()])); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertReposi... | AllBeneficiaries { public List<Child> findAllChildrenByCaseIDs(List<String> caseIds) { return childRepository.findChildrenByCaseIds(caseIds.toArray(new String[caseIds.size()])); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertReposi... |
@Test public void assertAllChildrenWithMotherAndEC() { Mockito.when(childRepository.allChildrenWithMotherAndEC()).thenReturn(Mockito.mock(List.class)); Assert.assertNotNull(allBeneficiaries.allChildrenWithMotherAndEC()); } | public List<Child> allChildrenWithMotherAndEC() { return childRepository.allChildrenWithMotherAndEC(); } | AllBeneficiaries { public List<Child> allChildrenWithMotherAndEC() { return childRepository.allChildrenWithMotherAndEC(); } } | AllBeneficiaries { public List<Child> allChildrenWithMotherAndEC() { return childRepository.allChildrenWithMotherAndEC(); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
... | AllBeneficiaries { public List<Child> allChildrenWithMotherAndEC() { return childRepository.allChildrenWithMotherAndEC(); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
... | AllBeneficiaries { public List<Child> allChildrenWithMotherAndEC() { return childRepository.allChildrenWithMotherAndEC(); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
... |
@Test public void assertFindAllChildrenByECId() { Mockito.when(childRepository.findAllChildrenByECId(Mockito.anyString())).thenReturn(Mockito.mock(List.class)); Assert.assertNotNull(allBeneficiaries.findAllChildrenByECId("")); } | public List<Child> findAllChildrenByECId(String ecId) { return childRepository.findAllChildrenByECId(ecId); } | AllBeneficiaries { public List<Child> findAllChildrenByECId(String ecId) { return childRepository.findAllChildrenByECId(ecId); } } | AllBeneficiaries { public List<Child> findAllChildrenByECId(String ecId) { return childRepository.findAllChildrenByECId(ecId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
... | AllBeneficiaries { public List<Child> findAllChildrenByECId(String ecId) { return childRepository.findAllChildrenByECId(ecId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
... | AllBeneficiaries { public List<Child> findAllChildrenByECId(String ecId) { return childRepository.findAllChildrenByECId(ecId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
... |
@Test public void assertFindMotherWithOpenStatusByECId() { Mockito.when(motherRepository.findMotherWithOpenStatusByECId(Mockito.anyString())).thenReturn(Mockito.mock(Mother.class)); Assert.assertNotNull(allBeneficiaries.findMotherWithOpenStatusByECId("")); } | public Mother findMotherWithOpenStatusByECId(String ecId) { return motherRepository.findMotherWithOpenStatusByECId(ecId); } | AllBeneficiaries { public Mother findMotherWithOpenStatusByECId(String ecId) { return motherRepository.findMotherWithOpenStatusByECId(ecId); } } | AllBeneficiaries { public Mother findMotherWithOpenStatusByECId(String ecId) { return motherRepository.findMotherWithOpenStatusByECId(ecId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
... | AllBeneficiaries { public Mother findMotherWithOpenStatusByECId(String ecId) { return motherRepository.findMotherWithOpenStatusByECId(ecId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
... | AllBeneficiaries { public Mother findMotherWithOpenStatusByECId(String ecId) { return motherRepository.findMotherWithOpenStatusByECId(ecId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
... |
@Test public void assertIsPregnant() { Mockito.when(motherRepository.isPregnant(Mockito.anyString())).thenReturn(false); Assert.assertEquals(allBeneficiaries.isPregnant(""), false); } | public boolean isPregnant(String ecId) { return motherRepository.isPregnant(ecId); } | AllBeneficiaries { public boolean isPregnant(String ecId) { return motherRepository.isPregnant(ecId); } } | AllBeneficiaries { public boolean isPregnant(String ecId) { return motherRepository.isPregnant(ecId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
timelineEv... | AllBeneficiaries { public boolean isPregnant(String ecId) { return motherRepository.isPregnant(ecId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
timelineEv... | AllBeneficiaries { public boolean isPregnant(String ecId) { return motherRepository.isPregnant(ecId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
timelineEv... |
@Test public void assertfillSubFormaddressSub_townAddsSub_town() throws Exception { String addressJsonWithSub_townString = "{\"entity_id\":\"mother\",\"value\":\"Kotwali\",\"openmrs_entity\":\"person_address\"," + "\"openmrs_entity_id\":\"sub_town\",\"hint\":\"address of household sub_town\"," + "\"openmrs_entity_paren... | public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bind == null || !bi... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... |
@Test public void assertSwitchMotherToPNC() { Mockito.doNothing().when(motherRepository).switchToPNC(Mockito.anyString()); allBeneficiaries.switchMotherToPNC(""); Mockito.verify(motherRepository, Mockito.times(1)).switchToPNC(Mockito.anyString()); } | public void switchMotherToPNC(String entityId) { motherRepository.switchToPNC(entityId); } | AllBeneficiaries { public void switchMotherToPNC(String entityId) { motherRepository.switchToPNC(entityId); } } | AllBeneficiaries { public void switchMotherToPNC(String entityId) { motherRepository.switchToPNC(entityId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
time... | AllBeneficiaries { public void switchMotherToPNC(String entityId) { motherRepository.switchToPNC(entityId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
time... | AllBeneficiaries { public void switchMotherToPNC(String entityId) { motherRepository.switchToPNC(entityId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
time... |
@Test public void assertFindAllMothersByCaseIDs() { Mockito.when(motherRepository.findByCaseIds(Mockito.any(String[].class))).thenReturn(Mockito.mock(List.class)); Assert.assertNotNull(allBeneficiaries.findAllMothersByCaseIDs(new ArrayList<String>())); } | public List<Mother> findAllMothersByCaseIDs(List<String> caseIds) { return motherRepository.findByCaseIds(caseIds.toArray(new String[caseIds.size()])); } | AllBeneficiaries { public List<Mother> findAllMothersByCaseIDs(List<String> caseIds) { return motherRepository.findByCaseIds(caseIds.toArray(new String[caseIds.size()])); } } | AllBeneficiaries { public List<Mother> findAllMothersByCaseIDs(List<String> caseIds) { return motherRepository.findByCaseIds(caseIds.toArray(new String[caseIds.size()])); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, T... | AllBeneficiaries { public List<Mother> findAllMothersByCaseIDs(List<String> caseIds) { return motherRepository.findByCaseIds(caseIds.toArray(new String[caseIds.size()])); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, T... | AllBeneficiaries { public List<Mother> findAllMothersByCaseIDs(List<String> caseIds) { return motherRepository.findByCaseIds(caseIds.toArray(new String[caseIds.size()])); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, T... |
@Test public void assertFindAllChildrenByMotherId() { Mockito.when(childRepository.findByMotherCaseId(Mockito.anyString())).thenReturn(Mockito.mock(List.class)); Assert.assertNotNull(allBeneficiaries.findAllChildrenByMotherId("")); } | public List<Child> findAllChildrenByMotherId(String entityId) { return childRepository.findByMotherCaseId(entityId); } | AllBeneficiaries { public List<Child> findAllChildrenByMotherId(String entityId) { return childRepository.findByMotherCaseId(entityId); } } | AllBeneficiaries { public List<Child> findAllChildrenByMotherId(String entityId) { return childRepository.findByMotherCaseId(entityId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
... | AllBeneficiaries { public List<Child> findAllChildrenByMotherId(String entityId) { return childRepository.findByMotherCaseId(entityId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
... | AllBeneficiaries { public List<Child> findAllChildrenByMotherId(String entityId) { return childRepository.findByMotherCaseId(entityId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
... |
@Test public void assertFindChild() { Mockito.when(childRepository.find(Mockito.anyString())).thenReturn(Mockito.mock(Child.class)); Assert.assertNotNull(allBeneficiaries.findChild("")); } | public Child findChild(String caseId) { return childRepository.find(caseId); } | AllBeneficiaries { public Child findChild(String caseId) { return childRepository.find(caseId); } } | AllBeneficiaries { public Child findChild(String caseId) { return childRepository.find(caseId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
timelineEventRep... | AllBeneficiaries { public Child findChild(String caseId) { return childRepository.find(caseId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
timelineEventRep... | AllBeneficiaries { public Child findChild(String caseId) { return childRepository.find(caseId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
timelineEventRep... |
@Test public void assertANCcountReturnsLong() { Mockito.when(motherRepository.ancCount()).thenReturn(0l); Assert.assertEquals(allBeneficiaries.ancCount(), 0l); } | public long ancCount() { return motherRepository.ancCount(); } | AllBeneficiaries { public long ancCount() { return motherRepository.ancCount(); } } | AllBeneficiaries { public long ancCount() { return motherRepository.ancCount(); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
timelineEventRepository); } | AllBeneficiaries { public long ancCount() { return motherRepository.ancCount(); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
timelineEventRepository); Mother... | AllBeneficiaries { public long ancCount() { return motherRepository.ancCount(); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
timelineEventRepository); Mother... |
@Test public void assertPNCcountReturnsLong() { Mockito.when(motherRepository.pncCount()).thenReturn(0l); Assert.assertEquals(allBeneficiaries.pncCount(), 0l); } | public long pncCount() { return motherRepository.pncCount(); } | AllBeneficiaries { public long pncCount() { return motherRepository.pncCount(); } } | AllBeneficiaries { public long pncCount() { return motherRepository.pncCount(); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
timelineEventRepository); } | AllBeneficiaries { public long pncCount() { return motherRepository.pncCount(); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
timelineEventRepository); Mother... | AllBeneficiaries { public long pncCount() { return motherRepository.pncCount(); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
timelineEventRepository); Mother... |
@Test public void assertChildcountReturnsLong() { Mockito.when(childRepository.count()).thenReturn(0l); Assert.assertEquals(allBeneficiaries.childCount(), 0l); } | public long childCount() { return childRepository.count(); } | AllBeneficiaries { public long childCount() { return childRepository.count(); } } | AllBeneficiaries { public long childCount() { return childRepository.count(); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
timelineEventRepository); } | AllBeneficiaries { public long childCount() { return childRepository.count(); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
timelineEventRepository); Mother f... | AllBeneficiaries { public long childCount() { return childRepository.count(); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
timelineEventRepository); Mother f... |
@Test public void assertAllANCsWithECReturnsList() { Mockito.when(motherRepository.allMothersOfATypeWithEC(Mockito.anyString())).thenReturn(Mockito.mock(List.class)); Assert.assertNotNull(allBeneficiaries.allANCsWithEC()); } | public List<Pair<Mother, EligibleCouple>> allANCsWithEC() { return motherRepository.allMothersOfATypeWithEC(TYPE_ANC); } | AllBeneficiaries { public List<Pair<Mother, EligibleCouple>> allANCsWithEC() { return motherRepository.allMothersOfATypeWithEC(TYPE_ANC); } } | AllBeneficiaries { public List<Pair<Mother, EligibleCouple>> allANCsWithEC() { return motherRepository.allMothersOfATypeWithEC(TYPE_ANC); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
... | AllBeneficiaries { public List<Pair<Mother, EligibleCouple>> allANCsWithEC() { return motherRepository.allMothersOfATypeWithEC(TYPE_ANC); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
... | AllBeneficiaries { public List<Pair<Mother, EligibleCouple>> allANCsWithEC() { return motherRepository.allMothersOfATypeWithEC(TYPE_ANC); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
... |
@Test public void assertAllPNCsWithECReturnsList() { Mockito.when(motherRepository.allMothersOfATypeWithEC(Mockito.anyString())).thenReturn(Mockito.mock(List.class)); Assert.assertNotNull(allBeneficiaries.allPNCsWithEC()); } | public List<Pair<Mother, EligibleCouple>> allPNCsWithEC() { return motherRepository.allMothersOfATypeWithEC(TYPE_PNC); } | AllBeneficiaries { public List<Pair<Mother, EligibleCouple>> allPNCsWithEC() { return motherRepository.allMothersOfATypeWithEC(TYPE_PNC); } } | AllBeneficiaries { public List<Pair<Mother, EligibleCouple>> allPNCsWithEC() { return motherRepository.allMothersOfATypeWithEC(TYPE_PNC); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
... | AllBeneficiaries { public List<Pair<Mother, EligibleCouple>> allPNCsWithEC() { return motherRepository.allMothersOfATypeWithEC(TYPE_PNC); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
... | AllBeneficiaries { public List<Pair<Mother, EligibleCouple>> allPNCsWithEC() { return motherRepository.allMothersOfATypeWithEC(TYPE_PNC); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
... |
@Test public void shouldDeleteTimelineEventsAndAlertsWhileClosingMother() throws Exception { allBeneficiaries.closeMother("entity id 1"); Mockito.verify(alertRepository).deleteAllAlertsForEntity("entity id 1"); Mockito.verify(timelineEventRepository).deleteAllTimelineEventsForEntity("entity id 1"); } | public void closeMother(String entityId) { alertRepository.deleteAllAlertsForEntity(entityId); timelineEventRepository.deleteAllTimelineEventsForEntity(entityId); motherRepository.close(entityId); } | AllBeneficiaries { public void closeMother(String entityId) { alertRepository.deleteAllAlertsForEntity(entityId); timelineEventRepository.deleteAllTimelineEventsForEntity(entityId); motherRepository.close(entityId); } } | AllBeneficiaries { public void closeMother(String entityId) { alertRepository.deleteAllAlertsForEntity(entityId); timelineEventRepository.deleteAllTimelineEventsForEntity(entityId); motherRepository.close(entityId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
... | AllBeneficiaries { public void closeMother(String entityId) { alertRepository.deleteAllAlertsForEntity(entityId); timelineEventRepository.deleteAllTimelineEventsForEntity(entityId); motherRepository.close(entityId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
... | AllBeneficiaries { public void closeMother(String entityId) { alertRepository.deleteAllAlertsForEntity(entityId); timelineEventRepository.deleteAllTimelineEventsForEntity(entityId); motherRepository.close(entityId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
... |
@Test public void assertfillSubFormaddressTownAddsTown() throws Exception { String addressJsonWithTownString = "{\"entity_id\":\"mother\",\"value\":\"Chittagong\",\"openmrs_entity\":\"person_address\"," + "\"openmrs_entity_id\":\"town\",\"hint\":\"address of household town\"," + "\"openmrs_entity_parent\":\"usual_resid... | public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bind == null || !bi... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... |
@Test public void shouldDeleteTimelineEventsAndAlertsForAllMothersWhenECIsClosed() throws Exception { Mockito.when(motherRepository.findAllCasesForEC("ec id 1")) .thenReturn(Arrays.asList(new Mother("mother id 1", "ec id 1", "12345", "2012-12-12"), new Mother("mother id 2", "ec id 2", "123456", "2012-12-10"))); allBene... | public void closeAllMothersForEC(String ecId) { List<Mother> mothers = motherRepository.findAllCasesForEC(ecId); if (mothers == null || mothers.isEmpty()) { return; } for (Mother mother : mothers) { closeMother(mother.caseId()); } } | AllBeneficiaries { public void closeAllMothersForEC(String ecId) { List<Mother> mothers = motherRepository.findAllCasesForEC(ecId); if (mothers == null || mothers.isEmpty()) { return; } for (Mother mother : mothers) { closeMother(mother.caseId()); } } } | AllBeneficiaries { public void closeAllMothersForEC(String ecId) { List<Mother> mothers = motherRepository.findAllCasesForEC(ecId); if (mothers == null || mothers.isEmpty()) { return; } for (Mother mother : mothers) { closeMother(mother.caseId()); } } AllBeneficiaries(MotherRepository motherRepository, ChildRepository ... | AllBeneficiaries { public void closeAllMothersForEC(String ecId) { List<Mother> mothers = motherRepository.findAllCasesForEC(ecId); if (mothers == null || mothers.isEmpty()) { return; } for (Mother mother : mothers) { closeMother(mother.caseId()); } } AllBeneficiaries(MotherRepository motherRepository, ChildRepository ... | AllBeneficiaries { public void closeAllMothersForEC(String ecId) { List<Mother> mothers = motherRepository.findAllCasesForEC(ecId); if (mothers == null || mothers.isEmpty()) { return; } for (Mother mother : mothers) { closeMother(mother.caseId()); } } AllBeneficiaries(MotherRepository motherRepository, ChildRepository ... |
@Test public void shouldDeleteTimelineEventsAndAlertsWhenAChildIsClosed() throws Exception { Mockito.when(childRepository.find("child id 1")) .thenReturn(new Child("child id 1", "mother id 1", "male", new HashMap<String, String>())); allBeneficiaries.closeChild("child id 1"); Mockito.verify(alertRepository).deleteAllAl... | public void closeChild(String entityId) { alertRepository.deleteAllAlertsForEntity(entityId); timelineEventRepository.deleteAllTimelineEventsForEntity(entityId); childRepository.close(entityId); } | AllBeneficiaries { public void closeChild(String entityId) { alertRepository.deleteAllAlertsForEntity(entityId); timelineEventRepository.deleteAllTimelineEventsForEntity(entityId); childRepository.close(entityId); } } | AllBeneficiaries { public void closeChild(String entityId) { alertRepository.deleteAllAlertsForEntity(entityId); timelineEventRepository.deleteAllTimelineEventsForEntity(entityId); childRepository.close(entityId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
... | AllBeneficiaries { public void closeChild(String entityId) { alertRepository.deleteAllAlertsForEntity(entityId); timelineEventRepository.deleteAllTimelineEventsForEntity(entityId); childRepository.close(entityId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
... | AllBeneficiaries { public void closeChild(String entityId) { alertRepository.deleteAllAlertsForEntity(entityId); timelineEventRepository.deleteAllTimelineEventsForEntity(entityId); childRepository.close(entityId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
... |
@Test public void shouldNotFailClosingMotherWhenECIsClosedAndDoesNotHaveAnyMothers() throws Exception { Mockito.when(motherRepository.findAllCasesForEC("ec id 1")).thenReturn(null); Mockito.when(motherRepository.findAllCasesForEC("ec id 1")).thenReturn(Collections.<Mother>emptyList()); allBeneficiaries.closeAllMothersF... | public void closeAllMothersForEC(String ecId) { List<Mother> mothers = motherRepository.findAllCasesForEC(ecId); if (mothers == null || mothers.isEmpty()) { return; } for (Mother mother : mothers) { closeMother(mother.caseId()); } } | AllBeneficiaries { public void closeAllMothersForEC(String ecId) { List<Mother> mothers = motherRepository.findAllCasesForEC(ecId); if (mothers == null || mothers.isEmpty()) { return; } for (Mother mother : mothers) { closeMother(mother.caseId()); } } } | AllBeneficiaries { public void closeAllMothersForEC(String ecId) { List<Mother> mothers = motherRepository.findAllCasesForEC(ecId); if (mothers == null || mothers.isEmpty()) { return; } for (Mother mother : mothers) { closeMother(mother.caseId()); } } AllBeneficiaries(MotherRepository motherRepository, ChildRepository ... | AllBeneficiaries { public void closeAllMothersForEC(String ecId) { List<Mother> mothers = motherRepository.findAllCasesForEC(ecId); if (mothers == null || mothers.isEmpty()) { return; } for (Mother mother : mothers) { closeMother(mother.caseId()); } } AllBeneficiaries(MotherRepository motherRepository, ChildRepository ... | AllBeneficiaries { public void closeAllMothersForEC(String ecId) { List<Mother> mothers = motherRepository.findAllCasesForEC(ecId); if (mothers == null || mothers.isEmpty()) { return; } for (Mother mother : mothers) { closeMother(mother.caseId()); } } AllBeneficiaries(MotherRepository motherRepository, ChildRepository ... |
@Test public void shouldDelegateToChildRepositoryWhenUpdateChildIsCalled() throws Exception { allBeneficiaries.updateChild(child); Mockito.verify(childRepository).update(child); } | public void updateChild(Child child) { childRepository.update(child); } | AllBeneficiaries { public void updateChild(Child child) { childRepository.update(child); } } | AllBeneficiaries { public void updateChild(Child child) { childRepository.update(child); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
timelineEventRepository... | AllBeneficiaries { public void updateChild(Child child) { childRepository.update(child); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
timelineEventRepository... | AllBeneficiaries { public void updateChild(Child child) { childRepository.update(child); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
timelineEventRepository... |
@Test public void shouldDelegateToMotherRepositoryWhenUpdateMotherIsCalled() throws Exception { allBeneficiaries.updateMother(mother); Mockito.verify(motherRepository).update(mother); } | public void updateMother(Mother mother) { motherRepository.update(mother); } | AllBeneficiaries { public void updateMother(Mother mother) { motherRepository.update(mother); } } | AllBeneficiaries { public void updateMother(Mother mother) { motherRepository.update(mother); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
timelineEventRepos... | AllBeneficiaries { public void updateMother(Mother mother) { motherRepository.update(mother); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
timelineEventRepos... | AllBeneficiaries { public void updateMother(Mother mother) { motherRepository.update(mother); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository,
AlertRepository alertRepository, TimelineEventRepository
timelineEventRepos... |
@Test public void assertupdateANMUserNameCallsPreferenceEdit() { allSharedPreferences.updateANMUserName(""); Mockito.verify(preferences, Mockito.times(2)).edit(); } | public void updateANMUserName(String userName) { preferences.edit().putString(ANM_IDENTIFIER_PREFERENCE_KEY, userName).commit(); Set<String> anmIdentifiers = new HashSet<>(preferences.getStringSet(ANM_IDENTIFIER_SET_PREFERENCE_KEY, new HashSet<>())); anmIdentifiers.add(userName); preferences.edit().putStringSet(ANM_IDE... | AllSharedPreferences { public void updateANMUserName(String userName) { preferences.edit().putString(ANM_IDENTIFIER_PREFERENCE_KEY, userName).commit(); Set<String> anmIdentifiers = new HashSet<>(preferences.getStringSet(ANM_IDENTIFIER_SET_PREFERENCE_KEY, new HashSet<>())); anmIdentifiers.add(userName); preferences.edit... | AllSharedPreferences { public void updateANMUserName(String userName) { preferences.edit().putString(ANM_IDENTIFIER_PREFERENCE_KEY, userName).commit(); Set<String> anmIdentifiers = new HashSet<>(preferences.getStringSet(ANM_IDENTIFIER_SET_PREFERENCE_KEY, new HashSet<>())); anmIdentifiers.add(userName); preferences.edit... | AllSharedPreferences { public void updateANMUserName(String userName) { preferences.edit().putString(ANM_IDENTIFIER_PREFERENCE_KEY, userName).commit(); Set<String> anmIdentifiers = new HashSet<>(preferences.getStringSet(ANM_IDENTIFIER_SET_PREFERENCE_KEY, new HashSet<>())); anmIdentifiers.add(userName); preferences.edit... | AllSharedPreferences { public void updateANMUserName(String userName) { preferences.edit().putString(ANM_IDENTIFIER_PREFERENCE_KEY, userName).commit(); Set<String> anmIdentifiers = new HashSet<>(preferences.getStringSet(ANM_IDENTIFIER_SET_PREFERENCE_KEY, new HashSet<>())); anmIdentifiers.add(userName); preferences.edit... |
@Test public void assertFetchForceRemoteLogin() { Mockito.when(preferences.getBoolean(AllConstants.FORCE_REMOTE_LOGIN + "_" + USERNAME, true)).thenReturn(true); Assert.assertEquals(allSharedPreferences.fetchForceRemoteLogin(USERNAME), true); } | public boolean fetchForceRemoteLogin(String username) { return preferences.getBoolean(new StringBuffer(AllConstants.FORCE_REMOTE_LOGIN).append('_').append(username).toString(), true); } | AllSharedPreferences { public boolean fetchForceRemoteLogin(String username) { return preferences.getBoolean(new StringBuffer(AllConstants.FORCE_REMOTE_LOGIN).append('_').append(username).toString(), true); } } | AllSharedPreferences { public boolean fetchForceRemoteLogin(String username) { return preferences.getBoolean(new StringBuffer(AllConstants.FORCE_REMOTE_LOGIN).append('_').append(username).toString(), true); } AllSharedPreferences(SharedPreferences preferences); } | AllSharedPreferences { public boolean fetchForceRemoteLogin(String username) { return preferences.getBoolean(new StringBuffer(AllConstants.FORCE_REMOTE_LOGIN).append('_').append(username).toString(), true); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegis... | AllSharedPreferences { public boolean fetchForceRemoteLogin(String username) { return preferences.getBoolean(new StringBuffer(AllConstants.FORCE_REMOTE_LOGIN).append('_').append(username).toString(), true); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegis... |
@Test public void assertFetchServerTimeZone() { Assert.assertEquals(str, allSharedPreferences.fetchServerTimeZone()); } | public String fetchServerTimeZone() { return preferences.getString(AllConstants.SERVER_TIMEZONE, null); } | AllSharedPreferences { public String fetchServerTimeZone() { return preferences.getString(AllConstants.SERVER_TIMEZONE, null); } } | AllSharedPreferences { public String fetchServerTimeZone() { return preferences.getString(AllConstants.SERVER_TIMEZONE, null); } AllSharedPreferences(SharedPreferences preferences); } | AllSharedPreferences { public String fetchServerTimeZone() { return preferences.getString(AllConstants.SERVER_TIMEZONE, null); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String userName); boolean fetchForceRemoteLo... | AllSharedPreferences { public String fetchServerTimeZone() { return preferences.getString(AllConstants.SERVER_TIMEZONE, null); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String userName); boolean fetchForceRemoteLo... |
@Test public void assertSaveServerTimeZone() { allSharedPreferences.saveServerTimeZone(""); Mockito.verify(preferences, Mockito.times(1)).edit(); } | public void saveServerTimeZone(String serverTimeZone) { preferences.edit().putString(AllConstants.SERVER_TIMEZONE, serverTimeZone).commit(); } | AllSharedPreferences { public void saveServerTimeZone(String serverTimeZone) { preferences.edit().putString(AllConstants.SERVER_TIMEZONE, serverTimeZone).commit(); } } | AllSharedPreferences { public void saveServerTimeZone(String serverTimeZone) { preferences.edit().putString(AllConstants.SERVER_TIMEZONE, serverTimeZone).commit(); } AllSharedPreferences(SharedPreferences preferences); } | AllSharedPreferences { public void saveServerTimeZone(String serverTimeZone) { preferences.edit().putString(AllConstants.SERVER_TIMEZONE, serverTimeZone).commit(); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String ... | AllSharedPreferences { public void saveServerTimeZone(String serverTimeZone) { preferences.edit().putString(AllConstants.SERVER_TIMEZONE, serverTimeZone).commit(); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String ... |
@Test public void assertFetchPioneerUser() { Assert.assertEquals(allSharedPreferences.fetchPioneerUser(), str); } | public String fetchPioneerUser() { return preferences.getString(AllConstants.PIONEER_USER, null); } | AllSharedPreferences { public String fetchPioneerUser() { return preferences.getString(AllConstants.PIONEER_USER, null); } } | AllSharedPreferences { public String fetchPioneerUser() { return preferences.getString(AllConstants.PIONEER_USER, null); } AllSharedPreferences(SharedPreferences preferences); } | AllSharedPreferences { public String fetchPioneerUser() { return preferences.getString(AllConstants.PIONEER_USER, null); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String userName); boolean fetchForceRemoteLogin(St... | AllSharedPreferences { public String fetchPioneerUser() { return preferences.getString(AllConstants.PIONEER_USER, null); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String userName); boolean fetchForceRemoteLogin(St... |
@Test public void assertfillSubformaddressSub_districtAddsSub_district() throws Exception { String addressJsonWithsub_districtString = "{\"entity_id\":\"mother\",\"value\":\"Chittagong\",\"openmrs_entity\":\"person_address\"," + "\"openmrs_entity_id\":\"sub_district\",\"hint\":\"address of household sub_district\"," + ... | public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bind == null || !bi... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... |
@Test public void assertfetchLastUpdatedAtDate() { Assert.assertEquals(allSharedPreferences.fetchLastUpdatedAtDate(0l), new Long(0l)); } | public Long fetchLastUpdatedAtDate(long lastSyncDate) { return preferences.getLong(LAST_UPDATED_AT_DATE, lastSyncDate); } | AllSharedPreferences { public Long fetchLastUpdatedAtDate(long lastSyncDate) { return preferences.getLong(LAST_UPDATED_AT_DATE, lastSyncDate); } } | AllSharedPreferences { public Long fetchLastUpdatedAtDate(long lastSyncDate) { return preferences.getLong(LAST_UPDATED_AT_DATE, lastSyncDate); } AllSharedPreferences(SharedPreferences preferences); } | AllSharedPreferences { public Long fetchLastUpdatedAtDate(long lastSyncDate) { return preferences.getLong(LAST_UPDATED_AT_DATE, lastSyncDate); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String userName); boolean fe... | AllSharedPreferences { public Long fetchLastUpdatedAtDate(long lastSyncDate) { return preferences.getLong(LAST_UPDATED_AT_DATE, lastSyncDate); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String userName); boolean fe... |
@Test public void assertsaveLastUpdatedAtDate() { allSharedPreferences.saveLastUpdatedAtDate(0l); Mockito.verify(preferences, Mockito.times(1)).edit(); } | public void saveLastUpdatedAtDate(long lastSyncDate) { preferences.edit().putLong(LAST_UPDATED_AT_DATE, lastSyncDate).commit(); } | AllSharedPreferences { public void saveLastUpdatedAtDate(long lastSyncDate) { preferences.edit().putLong(LAST_UPDATED_AT_DATE, lastSyncDate).commit(); } } | AllSharedPreferences { public void saveLastUpdatedAtDate(long lastSyncDate) { preferences.edit().putLong(LAST_UPDATED_AT_DATE, lastSyncDate).commit(); } AllSharedPreferences(SharedPreferences preferences); } | AllSharedPreferences { public void saveLastUpdatedAtDate(long lastSyncDate) { preferences.edit().putLong(LAST_UPDATED_AT_DATE, lastSyncDate).commit(); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String userName); bo... | AllSharedPreferences { public void saveLastUpdatedAtDate(long lastSyncDate) { preferences.edit().putLong(LAST_UPDATED_AT_DATE, lastSyncDate).commit(); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String userName); bo... |
@Test public void assertfetchCurrentLocality() { Assert.assertEquals(allSharedPreferences.fetchCurrentLocality(), str); } | public String fetchCurrentLocality() { return preferences.getString(AllConstants.CURRENT_LOCALITY, null); } | AllSharedPreferences { public String fetchCurrentLocality() { return preferences.getString(AllConstants.CURRENT_LOCALITY, null); } } | AllSharedPreferences { public String fetchCurrentLocality() { return preferences.getString(AllConstants.CURRENT_LOCALITY, null); } AllSharedPreferences(SharedPreferences preferences); } | AllSharedPreferences { public String fetchCurrentLocality() { return preferences.getString(AllConstants.CURRENT_LOCALITY, null); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String userName); boolean fetchForceRemote... | AllSharedPreferences { public String fetchCurrentLocality() { return preferences.getString(AllConstants.CURRENT_LOCALITY, null); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String userName); boolean fetchForceRemote... |
@Test public void assertsaveCurrentLocality() { allSharedPreferences.saveCurrentLocality("LoCaLiTy"); Mockito.verify(preferences, Mockito.times(1)).edit(); } | public void saveCurrentLocality(String currentLocality) { preferences.edit().putString(AllConstants.CURRENT_LOCALITY, currentLocality).commit(); } | AllSharedPreferences { public void saveCurrentLocality(String currentLocality) { preferences.edit().putString(AllConstants.CURRENT_LOCALITY, currentLocality).commit(); } } | AllSharedPreferences { public void saveCurrentLocality(String currentLocality) { preferences.edit().putString(AllConstants.CURRENT_LOCALITY, currentLocality).commit(); } AllSharedPreferences(SharedPreferences preferences); } | AllSharedPreferences { public void saveCurrentLocality(String currentLocality) { preferences.edit().putString(AllConstants.CURRENT_LOCALITY, currentLocality).commit(); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(Str... | AllSharedPreferences { public void saveCurrentLocality(String currentLocality) { preferences.edit().putString(AllConstants.CURRENT_LOCALITY, currentLocality).commit(); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(Str... |
@Test public void assertfetchCurrentDataStrategy() { Assert.assertEquals(allSharedPreferences.fetchCurrentDataStrategy(), str); } | public String fetchCurrentDataStrategy() { return preferences.getString(AllConstants.DATA_STRATEGY, AllConstants.DATA_CAPTURE_STRATEGY.NORMAL); } | AllSharedPreferences { public String fetchCurrentDataStrategy() { return preferences.getString(AllConstants.DATA_STRATEGY, AllConstants.DATA_CAPTURE_STRATEGY.NORMAL); } } | AllSharedPreferences { public String fetchCurrentDataStrategy() { return preferences.getString(AllConstants.DATA_STRATEGY, AllConstants.DATA_CAPTURE_STRATEGY.NORMAL); } AllSharedPreferences(SharedPreferences preferences); } | AllSharedPreferences { public String fetchCurrentDataStrategy() { return preferences.getString(AllConstants.DATA_STRATEGY, AllConstants.DATA_CAPTURE_STRATEGY.NORMAL); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(Stri... | AllSharedPreferences { public String fetchCurrentDataStrategy() { return preferences.getString(AllConstants.DATA_STRATEGY, AllConstants.DATA_CAPTURE_STRATEGY.NORMAL); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(Stri... |
@Test public void assertsaveCurrentDataStrategy() { allSharedPreferences.saveCurrentDataStrategy("Mobile Clinic"); Mockito.verify(preferences, Mockito.times(1)).edit(); } | public void saveCurrentDataStrategy(String currentDataStrategy) { preferences.edit().putString(AllConstants.DATA_STRATEGY, currentDataStrategy).commit(); } | AllSharedPreferences { public void saveCurrentDataStrategy(String currentDataStrategy) { preferences.edit().putString(AllConstants.DATA_STRATEGY, currentDataStrategy).commit(); } } | AllSharedPreferences { public void saveCurrentDataStrategy(String currentDataStrategy) { preferences.edit().putString(AllConstants.DATA_STRATEGY, currentDataStrategy).commit(); } AllSharedPreferences(SharedPreferences preferences); } | AllSharedPreferences { public void saveCurrentDataStrategy(String currentDataStrategy) { preferences.edit().putString(AllConstants.DATA_STRATEGY, currentDataStrategy).commit(); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegister... | AllSharedPreferences { public void saveCurrentDataStrategy(String currentDataStrategy) { preferences.edit().putString(AllConstants.DATA_STRATEGY, currentDataStrategy).commit(); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegister... |
@Test public void assertsaveLanguagePreference() { allSharedPreferences.saveLanguagePreference("EN"); Mockito.verify(preferences, Mockito.times(1)).edit(); } | public void saveLanguagePreference(String languagePreference) { preferences.edit().putString(AllConstants.LANGUAGE_PREFERENCE_KEY, languagePreference).commit(); } | AllSharedPreferences { public void saveLanguagePreference(String languagePreference) { preferences.edit().putString(AllConstants.LANGUAGE_PREFERENCE_KEY, languagePreference).commit(); } } | AllSharedPreferences { public void saveLanguagePreference(String languagePreference) { preferences.edit().putString(AllConstants.LANGUAGE_PREFERENCE_KEY, languagePreference).commit(); } AllSharedPreferences(SharedPreferences preferences); } | AllSharedPreferences { public void saveLanguagePreference(String languagePreference) { preferences.edit().putString(AllConstants.LANGUAGE_PREFERENCE_KEY, languagePreference).commit(); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isR... | AllSharedPreferences { public void saveLanguagePreference(String languagePreference) { preferences.edit().putString(AllConstants.LANGUAGE_PREFERENCE_KEY, languagePreference).commit(); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isR... |
@Test public void assertfetchBaseURL() { Assert.assertEquals(allSharedPreferences.fetchBaseURL(""), "http: } | public String fetchBaseURL(String baseurl) { String url = preferences.getString(AllConstants.DRISHTI_BASE_URL, baseurl); return StringUtils.isNotBlank(url) && url.endsWith("/") ? url.substring(0, url.length() - 1) : url; } | AllSharedPreferences { public String fetchBaseURL(String baseurl) { String url = preferences.getString(AllConstants.DRISHTI_BASE_URL, baseurl); return StringUtils.isNotBlank(url) && url.endsWith("/") ? url.substring(0, url.length() - 1) : url; } } | AllSharedPreferences { public String fetchBaseURL(String baseurl) { String url = preferences.getString(AllConstants.DRISHTI_BASE_URL, baseurl); return StringUtils.isNotBlank(url) && url.endsWith("/") ? url.substring(0, url.length() - 1) : url; } AllSharedPreferences(SharedPreferences preferences); } | AllSharedPreferences { public String fetchBaseURL(String baseurl) { String url = preferences.getString(AllConstants.DRISHTI_BASE_URL, baseurl); return StringUtils.isNotBlank(url) && url.endsWith("/") ? url.substring(0, url.length() - 1) : url; } AllSharedPreferences(SharedPreferences preferences); void updateANMUserNam... | AllSharedPreferences { public String fetchBaseURL(String baseurl) { String url = preferences.getString(AllConstants.DRISHTI_BASE_URL, baseurl); return StringUtils.isNotBlank(url) && url.endsWith("/") ? url.substring(0, url.length() - 1) : url; } AllSharedPreferences(SharedPreferences preferences); void updateANMUserNam... |
@Test public void assertsavePreference() { allSharedPreferences.savePreference("", ""); Mockito.verify(preferences, Mockito.times(1)).edit(); } | public void savePreference(String key, String value) { preferences.edit().putString(key, value).commit(); } | AllSharedPreferences { public void savePreference(String key, String value) { preferences.edit().putString(key, value).commit(); } } | AllSharedPreferences { public void savePreference(String key, String value) { preferences.edit().putString(key, value).commit(); } AllSharedPreferences(SharedPreferences preferences); } | AllSharedPreferences { public void savePreference(String key, String value) { preferences.edit().putString(key, value).commit(); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String userName); boolean fetchForceRemote... | AllSharedPreferences { public void savePreference(String key, String value) { preferences.edit().putString(key, value).commit(); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String userName); boolean fetchForceRemote... |
@Test public void assertgetPreference() { Assert.assertEquals(allSharedPreferences.getPreference(""), str); } | public String getPreference(String key) { return preferences.getString(key, ""); } | AllSharedPreferences { public String getPreference(String key) { return preferences.getString(key, ""); } } | AllSharedPreferences { public String getPreference(String key) { return preferences.getString(key, ""); } AllSharedPreferences(SharedPreferences preferences); } | AllSharedPreferences { public String getPreference(String key) { return preferences.getString(key, ""); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String userName); boolean fetchForceRemoteLogin(String username); v... | AllSharedPreferences { public String getPreference(String key) { return preferences.getString(key, ""); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String userName); boolean fetchForceRemoteLogin(String username); v... |
@Test public void assertfillSubformaddressDistrictAddsDistrict() throws Exception { String addressJsonWithDistrictString = "{\"entity_id\":\"mother\",\"value\":\"Chittagong\",\"openmrs_entity\":\"person_address\"," + "\"openmrs_entity_id\":\"district\",\"hint\":\"address of household district\"," + "\"openmrs_entity_pa... | public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bind == null || !bi... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... | JsonFormUtils { public static void fillSubFormAddressFields(JSONObject jsonObject, Map<String, Address> addresses, String bindType) { if (jsonObject == null) { return; } try { String value = getString(jsonObject, VALUE); if (StringUtils.isBlank(value)) { return; } String bind = getString(jsonObject, ENTITY_ID); if (bin... |
@Test public void assertupdateANMPreferredName() { allSharedPreferences.updateANMPreferredName("", ""); Mockito.verify(preferences, Mockito.times(1)).edit(); } | public void updateANMPreferredName(String userName, String preferredName) { preferences.edit().putString(userName, preferredName).commit(); } | AllSharedPreferences { public void updateANMPreferredName(String userName, String preferredName) { preferences.edit().putString(userName, preferredName).commit(); } } | AllSharedPreferences { public void updateANMPreferredName(String userName, String preferredName) { preferences.edit().putString(userName, preferredName).commit(); } AllSharedPreferences(SharedPreferences preferences); } | AllSharedPreferences { public void updateANMPreferredName(String userName, String preferredName) { preferences.edit().putString(userName, preferredName).commit(); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String u... | AllSharedPreferences { public void updateANMPreferredName(String userName, String preferredName) { preferences.edit().putString(userName, preferredName).commit(); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String u... |
@Test public void assertgetANMPreferredName() { org.junit.Assert.assertEquals(allSharedPreferences.getANMPreferredName("uname"), str); } | public String getANMPreferredName(String userName) { return preferences.getString(userName, ""); } | AllSharedPreferences { public String getANMPreferredName(String userName) { return preferences.getString(userName, ""); } } | AllSharedPreferences { public String getANMPreferredName(String userName) { return preferences.getString(userName, ""); } AllSharedPreferences(SharedPreferences preferences); } | AllSharedPreferences { public String getANMPreferredName(String userName) { return preferences.getString(userName, ""); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String userName); boolean fetchForceRemoteLogin(Str... | AllSharedPreferences { public String getANMPreferredName(String userName) { return preferences.getString(userName, ""); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String userName); boolean fetchForceRemoteLogin(Str... |
@Test public void assertfetchHost() { Assert.assertEquals(allSharedPreferences.fetchHost(""), ""); Assert.assertEquals(allSharedPreferences.fetchHost(null), str); Mockito.when(preferences.getString(AllConstants.DRISHTI_BASE_URL, "")).thenReturn("Malformed Url"); Assert.assertEquals(allSharedPreferences.fetchHost(""), "... | public String fetchHost(String host) { if ((host == null || host.isEmpty()) && preferences.getString(HOST, host).equals(host)) { updateUrl(fetchBaseURL("")); } return preferences.getString(HOST, host); } | AllSharedPreferences { public String fetchHost(String host) { if ((host == null || host.isEmpty()) && preferences.getString(HOST, host).equals(host)) { updateUrl(fetchBaseURL("")); } return preferences.getString(HOST, host); } } | AllSharedPreferences { public String fetchHost(String host) { if ((host == null || host.isEmpty()) && preferences.getString(HOST, host).equals(host)) { updateUrl(fetchBaseURL("")); } return preferences.getString(HOST, host); } AllSharedPreferences(SharedPreferences preferences); } | AllSharedPreferences { public String fetchHost(String host) { if ((host == null || host.isEmpty()) && preferences.getString(HOST, host).equals(host)) { updateUrl(fetchBaseURL("")); } return preferences.getString(HOST, host); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName);... | AllSharedPreferences { public String fetchHost(String host) { if ((host == null || host.isEmpty()) && preferences.getString(HOST, host).equals(host)) { updateUrl(fetchBaseURL("")); } return preferences.getString(HOST, host); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName);... |
@Test public void assertfetchPort() { Assert.assertEquals(allSharedPreferences.fetchPort(new Integer(80)), new Integer(8080)); } | public Integer fetchPort(Integer port) { return Integer.parseInt(preferences.getString(PORT, "" + port)); } | AllSharedPreferences { public Integer fetchPort(Integer port) { return Integer.parseInt(preferences.getString(PORT, "" + port)); } } | AllSharedPreferences { public Integer fetchPort(Integer port) { return Integer.parseInt(preferences.getString(PORT, "" + port)); } AllSharedPreferences(SharedPreferences preferences); } | AllSharedPreferences { public Integer fetchPort(Integer port) { return Integer.parseInt(preferences.getString(PORT, "" + port)); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String userName); boolean fetchForceRemote... | AllSharedPreferences { public Integer fetchPort(Integer port) { return Integer.parseInt(preferences.getString(PORT, "" + port)); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String userName); boolean fetchForceRemote... |
@Test public void assertSavePioneerUser() { allSharedPreferences.savePioneerUser("uname"); Mockito.verify(preferences, Mockito.times(1)).edit(); } | public void savePioneerUser(String username) { preferences.edit().putString(AllConstants.PIONEER_USER, username).commit(); } | AllSharedPreferences { public void savePioneerUser(String username) { preferences.edit().putString(AllConstants.PIONEER_USER, username).commit(); } } | AllSharedPreferences { public void savePioneerUser(String username) { preferences.edit().putString(AllConstants.PIONEER_USER, username).commit(); } AllSharedPreferences(SharedPreferences preferences); } | AllSharedPreferences { public void savePioneerUser(String username) { preferences.edit().putString(AllConstants.PIONEER_USER, username).commit(); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String userName); boolean... | AllSharedPreferences { public void savePioneerUser(String username) { preferences.edit().putString(AllConstants.PIONEER_USER, username).commit(); } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegisteredANM(); boolean isRegisteredANM(String userName); boolean... |
@Test public void assertSaveDefaultLocalityId() { allSharedPreferences.saveDefaultLocalityId("uname", "Id"); Mockito.verify(preferences, Mockito.times(1)).edit(); } | public void saveDefaultLocalityId(String username, String localityId) { if (username != null) { preferences.edit().putString(AllConstants.DEFAULT_LOCALITY_ID_PREFIX + username, localityId) .commit(); } } | AllSharedPreferences { public void saveDefaultLocalityId(String username, String localityId) { if (username != null) { preferences.edit().putString(AllConstants.DEFAULT_LOCALITY_ID_PREFIX + username, localityId) .commit(); } } } | AllSharedPreferences { public void saveDefaultLocalityId(String username, String localityId) { if (username != null) { preferences.edit().putString(AllConstants.DEFAULT_LOCALITY_ID_PREFIX + username, localityId) .commit(); } } AllSharedPreferences(SharedPreferences preferences); } | AllSharedPreferences { public void saveDefaultLocalityId(String username, String localityId) { if (username != null) { preferences.edit().putString(AllConstants.DEFAULT_LOCALITY_ID_PREFIX + username, localityId) .commit(); } } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName);... | AllSharedPreferences { public void saveDefaultLocalityId(String username, String localityId) { if (username != null) { preferences.edit().putString(AllConstants.DEFAULT_LOCALITY_ID_PREFIX + username, localityId) .commit(); } } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName);... |
@Test public void assertFetchDefaultLocalityId() { org.junit.Assert.assertNull(allSharedPreferences.fetchDefaultLocalityId(null)); org.junit.Assert.assertEquals(allSharedPreferences.fetchDefaultLocalityId(""), str); } | public String fetchDefaultLocalityId(String username) { if (username != null) { return preferences.getString(AllConstants.DEFAULT_LOCALITY_ID_PREFIX + username, null); } return null; } | AllSharedPreferences { public String fetchDefaultLocalityId(String username) { if (username != null) { return preferences.getString(AllConstants.DEFAULT_LOCALITY_ID_PREFIX + username, null); } return null; } } | AllSharedPreferences { public String fetchDefaultLocalityId(String username) { if (username != null) { return preferences.getString(AllConstants.DEFAULT_LOCALITY_ID_PREFIX + username, null); } return null; } AllSharedPreferences(SharedPreferences preferences); } | AllSharedPreferences { public String fetchDefaultLocalityId(String username) { if (username != null) { return preferences.getString(AllConstants.DEFAULT_LOCALITY_ID_PREFIX + username, null); } return null; } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegist... | AllSharedPreferences { public String fetchDefaultLocalityId(String username) { if (username != null) { return preferences.getString(AllConstants.DEFAULT_LOCALITY_ID_PREFIX + username, null); } return null; } AllSharedPreferences(SharedPreferences preferences); void updateANMUserName(String userName); String fetchRegist... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.