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 testRemoveLocationsFromHierarchyShouldRemoveParentLocationIfOnlyChildIsRemoved() throws Exception { Set<String> locations = Collections.singleton("67c5e0a4-132f-457b-b573-9abf5ec95c75"); validateAssignmentHelper.removeLocationsFromHierarchy(locationTree, locations); verify(settingsRepository).saveANMLocation(stringArgumentCaptor.capture()); assertNotEquals(locationHierarchy, stringArgumentCaptor.getValue()); LocationTree locationTree = gson.fromJson(stringArgumentCaptor.getValue(), LocationTree.class); assertFalse(locationTree.hasLocation("67c5e0a4-132f-457b-b573-9abf5ec95c75")); assertFalse(locationTree.hasLocation("4ed8f536-5c08-4203-8a90-a7e13becb01d")); verify(anmLocationController).evict(); } | @VisibleForTesting protected void removeLocationsFromHierarchy(LocationTree locationTree, Set<String> removedAssignments) throws AuthenticatorException, OperationCanceledException, IOException { for (String removedAssignment : removedAssignments) { locationTree.deleteLocation(removedAssignment); } settingsRepository.saveANMLocation(gson.toJson(locationTree)); anmLocationController.evict(); String defaultLocationUuid = allSharedPreferences.fetchDefaultLocalityId(allSharedPreferences.fetchRegisteredANM()); if (StringUtils.isNotBlank(defaultLocationUuid) && removedAssignments.contains(defaultLocationUuid)) { logoff(R.string.default_location_revoked_logged_off); } } | ValidateAssignmentHelper extends BaseHelper { @VisibleForTesting protected void removeLocationsFromHierarchy(LocationTree locationTree, Set<String> removedAssignments) throws AuthenticatorException, OperationCanceledException, IOException { for (String removedAssignment : removedAssignments) { locationTree.deleteLocation(removedAssignment); } settingsRepository.saveANMLocation(gson.toJson(locationTree)); anmLocationController.evict(); String defaultLocationUuid = allSharedPreferences.fetchDefaultLocalityId(allSharedPreferences.fetchRegisteredANM()); if (StringUtils.isNotBlank(defaultLocationUuid) && removedAssignments.contains(defaultLocationUuid)) { logoff(R.string.default_location_revoked_logged_off); } } } | ValidateAssignmentHelper extends BaseHelper { @VisibleForTesting protected void removeLocationsFromHierarchy(LocationTree locationTree, Set<String> removedAssignments) throws AuthenticatorException, OperationCanceledException, IOException { for (String removedAssignment : removedAssignments) { locationTree.deleteLocation(removedAssignment); } settingsRepository.saveANMLocation(gson.toJson(locationTree)); anmLocationController.evict(); String defaultLocationUuid = allSharedPreferences.fetchDefaultLocalityId(allSharedPreferences.fetchRegisteredANM()); if (StringUtils.isNotBlank(defaultLocationUuid) && removedAssignments.contains(defaultLocationUuid)) { logoff(R.string.default_location_revoked_logged_off); } } ValidateAssignmentHelper(SyncUtils syncUtils); } | ValidateAssignmentHelper extends BaseHelper { @VisibleForTesting protected void removeLocationsFromHierarchy(LocationTree locationTree, Set<String> removedAssignments) throws AuthenticatorException, OperationCanceledException, IOException { for (String removedAssignment : removedAssignments) { locationTree.deleteLocation(removedAssignment); } settingsRepository.saveANMLocation(gson.toJson(locationTree)); anmLocationController.evict(); String defaultLocationUuid = allSharedPreferences.fetchDefaultLocalityId(allSharedPreferences.fetchRegisteredANM()); if (StringUtils.isNotBlank(defaultLocationUuid) && removedAssignments.contains(defaultLocationUuid)) { logoff(R.string.default_location_revoked_logged_off); } } ValidateAssignmentHelper(SyncUtils syncUtils); void validateUserAssignment(); } | ValidateAssignmentHelper extends BaseHelper { @VisibleForTesting protected void removeLocationsFromHierarchy(LocationTree locationTree, Set<String> removedAssignments) throws AuthenticatorException, OperationCanceledException, IOException { for (String removedAssignment : removedAssignments) { locationTree.deleteLocation(removedAssignment); } settingsRepository.saveANMLocation(gson.toJson(locationTree)); anmLocationController.evict(); String defaultLocationUuid = allSharedPreferences.fetchDefaultLocalityId(allSharedPreferences.fetchRegisteredANM()); if (StringUtils.isNotBlank(defaultLocationUuid) && removedAssignments.contains(defaultLocationUuid)) { logoff(R.string.default_location_revoked_logged_off); } } ValidateAssignmentHelper(SyncUtils syncUtils); void validateUserAssignment(); static final String ACTION_ASSIGNMENT_REMOVED; static final String ASSIGNMENTS_REMOVED; static final Gson gson; } |
@Test public void testRemoveLocationsFromHierarchyShouldLogoffIfDefaultLocationIsRemoved() throws Exception { when(allSharedPreferences.fetchDefaultLocalityId(nullable(String.class))).thenReturn("67c5e0a4-132f-457b-b573-9abf5ec95c75"); Set<String> locations = Collections.singleton("67c5e0a4-132f-457b-b573-9abf5ec95c75"); validateAssignmentHelper.removeLocationsFromHierarchy(locationTree, locations); verify(settingsRepository).saveANMLocation(stringArgumentCaptor.capture()); assertNotEquals(locationHierarchy, stringArgumentCaptor.getValue()); LocationTree locationTree = gson.fromJson(stringArgumentCaptor.getValue(), LocationTree.class); assertFalse(locationTree.hasLocation("67c5e0a4-132f-457b-b573-9abf5ec95c75")); assertFalse(locationTree.hasLocation("4ed8f536-5c08-4203-8a90-a7e13becb01d")); verify(anmLocationController).evict(); verify(syncUtils).logoutUser(R.string.default_location_revoked_logged_off); } | @VisibleForTesting protected void removeLocationsFromHierarchy(LocationTree locationTree, Set<String> removedAssignments) throws AuthenticatorException, OperationCanceledException, IOException { for (String removedAssignment : removedAssignments) { locationTree.deleteLocation(removedAssignment); } settingsRepository.saveANMLocation(gson.toJson(locationTree)); anmLocationController.evict(); String defaultLocationUuid = allSharedPreferences.fetchDefaultLocalityId(allSharedPreferences.fetchRegisteredANM()); if (StringUtils.isNotBlank(defaultLocationUuid) && removedAssignments.contains(defaultLocationUuid)) { logoff(R.string.default_location_revoked_logged_off); } } | ValidateAssignmentHelper extends BaseHelper { @VisibleForTesting protected void removeLocationsFromHierarchy(LocationTree locationTree, Set<String> removedAssignments) throws AuthenticatorException, OperationCanceledException, IOException { for (String removedAssignment : removedAssignments) { locationTree.deleteLocation(removedAssignment); } settingsRepository.saveANMLocation(gson.toJson(locationTree)); anmLocationController.evict(); String defaultLocationUuid = allSharedPreferences.fetchDefaultLocalityId(allSharedPreferences.fetchRegisteredANM()); if (StringUtils.isNotBlank(defaultLocationUuid) && removedAssignments.contains(defaultLocationUuid)) { logoff(R.string.default_location_revoked_logged_off); } } } | ValidateAssignmentHelper extends BaseHelper { @VisibleForTesting protected void removeLocationsFromHierarchy(LocationTree locationTree, Set<String> removedAssignments) throws AuthenticatorException, OperationCanceledException, IOException { for (String removedAssignment : removedAssignments) { locationTree.deleteLocation(removedAssignment); } settingsRepository.saveANMLocation(gson.toJson(locationTree)); anmLocationController.evict(); String defaultLocationUuid = allSharedPreferences.fetchDefaultLocalityId(allSharedPreferences.fetchRegisteredANM()); if (StringUtils.isNotBlank(defaultLocationUuid) && removedAssignments.contains(defaultLocationUuid)) { logoff(R.string.default_location_revoked_logged_off); } } ValidateAssignmentHelper(SyncUtils syncUtils); } | ValidateAssignmentHelper extends BaseHelper { @VisibleForTesting protected void removeLocationsFromHierarchy(LocationTree locationTree, Set<String> removedAssignments) throws AuthenticatorException, OperationCanceledException, IOException { for (String removedAssignment : removedAssignments) { locationTree.deleteLocation(removedAssignment); } settingsRepository.saveANMLocation(gson.toJson(locationTree)); anmLocationController.evict(); String defaultLocationUuid = allSharedPreferences.fetchDefaultLocalityId(allSharedPreferences.fetchRegisteredANM()); if (StringUtils.isNotBlank(defaultLocationUuid) && removedAssignments.contains(defaultLocationUuid)) { logoff(R.string.default_location_revoked_logged_off); } } ValidateAssignmentHelper(SyncUtils syncUtils); void validateUserAssignment(); } | ValidateAssignmentHelper extends BaseHelper { @VisibleForTesting protected void removeLocationsFromHierarchy(LocationTree locationTree, Set<String> removedAssignments) throws AuthenticatorException, OperationCanceledException, IOException { for (String removedAssignment : removedAssignments) { locationTree.deleteLocation(removedAssignment); } settingsRepository.saveANMLocation(gson.toJson(locationTree)); anmLocationController.evict(); String defaultLocationUuid = allSharedPreferences.fetchDefaultLocalityId(allSharedPreferences.fetchRegisteredANM()); if (StringUtils.isNotBlank(defaultLocationUuid) && removedAssignments.contains(defaultLocationUuid)) { logoff(R.string.default_location_revoked_logged_off); } } ValidateAssignmentHelper(SyncUtils syncUtils); void validateUserAssignment(); static final String ACTION_ASSIGNMENT_REMOVED; static final String ASSIGNMENTS_REMOVED; static final Gson gson; } |
@Test public void testValidateUserAssignmentShouldDoNothingIfKeycloakIsNotEnabled() { validateAssignmentHelper.validateUserAssignment(); verifyNoMoreInteractions(userService); verifyNoMoreInteractions(userService); verifyNoMoreInteractions(locationRepository); } | public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmentDTO currentUserAssignment = gson.fromJson(assignment, UserAssignmentDTO.class); Set<Long> existingOrganizations = userService.fetchOrganizations(); Set<String> existingJurisdictions = new HashSet<>(locationRepository.getAllLocationIds()); Set<String> existingPlans = planDefinitionRepository.findAllPlanDefinitionIds(); boolean newAssignments = hasNewAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions); UserAssignmentDTO removedAssignments = processRemovedAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions, existingPlans); if (newAssignments) { logoff(R.string.account_new_assignment_logged_off); resetSync(); } else if (removedAssignments.isRemoved()) { Intent intent = new Intent(); intent.setAction(ACTION_ASSIGNMENT_REMOVED); intent.putExtra(ASSIGNMENTS_REMOVED, removedAssignments); CoreLibrary.getInstance().context().applicationContext().sendBroadcast(intent); } } } catch (Exception e) { Timber.e(e); } } | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmentDTO currentUserAssignment = gson.fromJson(assignment, UserAssignmentDTO.class); Set<Long> existingOrganizations = userService.fetchOrganizations(); Set<String> existingJurisdictions = new HashSet<>(locationRepository.getAllLocationIds()); Set<String> existingPlans = planDefinitionRepository.findAllPlanDefinitionIds(); boolean newAssignments = hasNewAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions); UserAssignmentDTO removedAssignments = processRemovedAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions, existingPlans); if (newAssignments) { logoff(R.string.account_new_assignment_logged_off); resetSync(); } else if (removedAssignments.isRemoved()) { Intent intent = new Intent(); intent.setAction(ACTION_ASSIGNMENT_REMOVED); intent.putExtra(ASSIGNMENTS_REMOVED, removedAssignments); CoreLibrary.getInstance().context().applicationContext().sendBroadcast(intent); } } } catch (Exception e) { Timber.e(e); } } } | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmentDTO currentUserAssignment = gson.fromJson(assignment, UserAssignmentDTO.class); Set<Long> existingOrganizations = userService.fetchOrganizations(); Set<String> existingJurisdictions = new HashSet<>(locationRepository.getAllLocationIds()); Set<String> existingPlans = planDefinitionRepository.findAllPlanDefinitionIds(); boolean newAssignments = hasNewAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions); UserAssignmentDTO removedAssignments = processRemovedAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions, existingPlans); if (newAssignments) { logoff(R.string.account_new_assignment_logged_off); resetSync(); } else if (removedAssignments.isRemoved()) { Intent intent = new Intent(); intent.setAction(ACTION_ASSIGNMENT_REMOVED); intent.putExtra(ASSIGNMENTS_REMOVED, removedAssignments); CoreLibrary.getInstance().context().applicationContext().sendBroadcast(intent); } } } catch (Exception e) { Timber.e(e); } } ValidateAssignmentHelper(SyncUtils syncUtils); } | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmentDTO currentUserAssignment = gson.fromJson(assignment, UserAssignmentDTO.class); Set<Long> existingOrganizations = userService.fetchOrganizations(); Set<String> existingJurisdictions = new HashSet<>(locationRepository.getAllLocationIds()); Set<String> existingPlans = planDefinitionRepository.findAllPlanDefinitionIds(); boolean newAssignments = hasNewAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions); UserAssignmentDTO removedAssignments = processRemovedAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions, existingPlans); if (newAssignments) { logoff(R.string.account_new_assignment_logged_off); resetSync(); } else if (removedAssignments.isRemoved()) { Intent intent = new Intent(); intent.setAction(ACTION_ASSIGNMENT_REMOVED); intent.putExtra(ASSIGNMENTS_REMOVED, removedAssignments); CoreLibrary.getInstance().context().applicationContext().sendBroadcast(intent); } } } catch (Exception e) { Timber.e(e); } } ValidateAssignmentHelper(SyncUtils syncUtils); void validateUserAssignment(); } | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmentDTO currentUserAssignment = gson.fromJson(assignment, UserAssignmentDTO.class); Set<Long> existingOrganizations = userService.fetchOrganizations(); Set<String> existingJurisdictions = new HashSet<>(locationRepository.getAllLocationIds()); Set<String> existingPlans = planDefinitionRepository.findAllPlanDefinitionIds(); boolean newAssignments = hasNewAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions); UserAssignmentDTO removedAssignments = processRemovedAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions, existingPlans); if (newAssignments) { logoff(R.string.account_new_assignment_logged_off); resetSync(); } else if (removedAssignments.isRemoved()) { Intent intent = new Intent(); intent.setAction(ACTION_ASSIGNMENT_REMOVED); intent.putExtra(ASSIGNMENTS_REMOVED, removedAssignments); CoreLibrary.getInstance().context().applicationContext().sendBroadcast(intent); } } } catch (Exception e) { Timber.e(e); } } ValidateAssignmentHelper(SyncUtils syncUtils); void validateUserAssignment(); static final String ACTION_ASSIGNMENT_REMOVED; static final String ASSIGNMENTS_REMOVED; static final Gson gson; } |
@Test public void testValidateUserAssignmentShouldDoNothingIfAPICallReturnsAnError() { when(allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED)).thenReturn(true); when(httpAgent.fetch(anyString())).thenReturn(new Response<>(ResponseStatus.failure, null)); validateAssignmentHelper.validateUserAssignment(); verify(allSharedPreferences).getBooleanPreference(IS_KEYCLOAK_CONFIGURED); verify(httpAgent).fetch("http: verifyNoMoreInteractions(userService); verifyNoMoreInteractions(userService); verifyNoMoreInteractions(locationRepository); } | public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmentDTO currentUserAssignment = gson.fromJson(assignment, UserAssignmentDTO.class); Set<Long> existingOrganizations = userService.fetchOrganizations(); Set<String> existingJurisdictions = new HashSet<>(locationRepository.getAllLocationIds()); Set<String> existingPlans = planDefinitionRepository.findAllPlanDefinitionIds(); boolean newAssignments = hasNewAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions); UserAssignmentDTO removedAssignments = processRemovedAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions, existingPlans); if (newAssignments) { logoff(R.string.account_new_assignment_logged_off); resetSync(); } else if (removedAssignments.isRemoved()) { Intent intent = new Intent(); intent.setAction(ACTION_ASSIGNMENT_REMOVED); intent.putExtra(ASSIGNMENTS_REMOVED, removedAssignments); CoreLibrary.getInstance().context().applicationContext().sendBroadcast(intent); } } } catch (Exception e) { Timber.e(e); } } | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmentDTO currentUserAssignment = gson.fromJson(assignment, UserAssignmentDTO.class); Set<Long> existingOrganizations = userService.fetchOrganizations(); Set<String> existingJurisdictions = new HashSet<>(locationRepository.getAllLocationIds()); Set<String> existingPlans = planDefinitionRepository.findAllPlanDefinitionIds(); boolean newAssignments = hasNewAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions); UserAssignmentDTO removedAssignments = processRemovedAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions, existingPlans); if (newAssignments) { logoff(R.string.account_new_assignment_logged_off); resetSync(); } else if (removedAssignments.isRemoved()) { Intent intent = new Intent(); intent.setAction(ACTION_ASSIGNMENT_REMOVED); intent.putExtra(ASSIGNMENTS_REMOVED, removedAssignments); CoreLibrary.getInstance().context().applicationContext().sendBroadcast(intent); } } } catch (Exception e) { Timber.e(e); } } } | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmentDTO currentUserAssignment = gson.fromJson(assignment, UserAssignmentDTO.class); Set<Long> existingOrganizations = userService.fetchOrganizations(); Set<String> existingJurisdictions = new HashSet<>(locationRepository.getAllLocationIds()); Set<String> existingPlans = planDefinitionRepository.findAllPlanDefinitionIds(); boolean newAssignments = hasNewAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions); UserAssignmentDTO removedAssignments = processRemovedAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions, existingPlans); if (newAssignments) { logoff(R.string.account_new_assignment_logged_off); resetSync(); } else if (removedAssignments.isRemoved()) { Intent intent = new Intent(); intent.setAction(ACTION_ASSIGNMENT_REMOVED); intent.putExtra(ASSIGNMENTS_REMOVED, removedAssignments); CoreLibrary.getInstance().context().applicationContext().sendBroadcast(intent); } } } catch (Exception e) { Timber.e(e); } } ValidateAssignmentHelper(SyncUtils syncUtils); } | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmentDTO currentUserAssignment = gson.fromJson(assignment, UserAssignmentDTO.class); Set<Long> existingOrganizations = userService.fetchOrganizations(); Set<String> existingJurisdictions = new HashSet<>(locationRepository.getAllLocationIds()); Set<String> existingPlans = planDefinitionRepository.findAllPlanDefinitionIds(); boolean newAssignments = hasNewAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions); UserAssignmentDTO removedAssignments = processRemovedAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions, existingPlans); if (newAssignments) { logoff(R.string.account_new_assignment_logged_off); resetSync(); } else if (removedAssignments.isRemoved()) { Intent intent = new Intent(); intent.setAction(ACTION_ASSIGNMENT_REMOVED); intent.putExtra(ASSIGNMENTS_REMOVED, removedAssignments); CoreLibrary.getInstance().context().applicationContext().sendBroadcast(intent); } } } catch (Exception e) { Timber.e(e); } } ValidateAssignmentHelper(SyncUtils syncUtils); void validateUserAssignment(); } | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmentDTO currentUserAssignment = gson.fromJson(assignment, UserAssignmentDTO.class); Set<Long> existingOrganizations = userService.fetchOrganizations(); Set<String> existingJurisdictions = new HashSet<>(locationRepository.getAllLocationIds()); Set<String> existingPlans = planDefinitionRepository.findAllPlanDefinitionIds(); boolean newAssignments = hasNewAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions); UserAssignmentDTO removedAssignments = processRemovedAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions, existingPlans); if (newAssignments) { logoff(R.string.account_new_assignment_logged_off); resetSync(); } else if (removedAssignments.isRemoved()) { Intent intent = new Intent(); intent.setAction(ACTION_ASSIGNMENT_REMOVED); intent.putExtra(ASSIGNMENTS_REMOVED, removedAssignments); CoreLibrary.getInstance().context().applicationContext().sendBroadcast(intent); } } } catch (Exception e) { Timber.e(e); } } ValidateAssignmentHelper(SyncUtils syncUtils); void validateUserAssignment(); static final String ACTION_ASSIGNMENT_REMOVED; static final String ASSIGNMENTS_REMOVED; static final Gson gson; } |
@Test public void testValidateUserAssignmentShouldLogoffAndResetSync() throws Exception { when(allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED)).thenReturn(true); when(httpAgent.fetch(anyString())).thenReturn(new Response<>(ResponseStatus.success, gson.toJson(userAssignment))); validateAssignmentHelper.validateUserAssignment(); verify(allSharedPreferences).getBooleanPreference(IS_KEYCLOAK_CONFIGURED); verify(httpAgent).fetch(anyString()); verify(planDefinitionRepository).findAllPlanDefinitionIds(); verify(locationRepository).getAllLocationIds(); verify(userService).fetchOrganizations(); verify(userService).hasSessionExpired(); verify(syncUtils).logoutUser(R.string.account_new_assignment_logged_off); verify(allSharedPreferences).savePreference(LOCATION_LAST_SYNC_DATE, "0"); verify(allSharedPreferences).savePreference(STRUCTURES_LAST_SYNC_DATE, "0"); verify(allSharedPreferences).savePreference(PLAN_LAST_SYNC_DATE, "0"); verify(allSharedPreferences).savePreference(TASK_LAST_SYNC_DATE, "0"); verify(allSharedPreferences).saveLastSyncDate(0); verifyNoMoreInteractions(planDefinitionRepository); verifyNoMoreInteractions(userService); verifyNoMoreInteractions(locationRepository); } | public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmentDTO currentUserAssignment = gson.fromJson(assignment, UserAssignmentDTO.class); Set<Long> existingOrganizations = userService.fetchOrganizations(); Set<String> existingJurisdictions = new HashSet<>(locationRepository.getAllLocationIds()); Set<String> existingPlans = planDefinitionRepository.findAllPlanDefinitionIds(); boolean newAssignments = hasNewAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions); UserAssignmentDTO removedAssignments = processRemovedAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions, existingPlans); if (newAssignments) { logoff(R.string.account_new_assignment_logged_off); resetSync(); } else if (removedAssignments.isRemoved()) { Intent intent = new Intent(); intent.setAction(ACTION_ASSIGNMENT_REMOVED); intent.putExtra(ASSIGNMENTS_REMOVED, removedAssignments); CoreLibrary.getInstance().context().applicationContext().sendBroadcast(intent); } } } catch (Exception e) { Timber.e(e); } } | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmentDTO currentUserAssignment = gson.fromJson(assignment, UserAssignmentDTO.class); Set<Long> existingOrganizations = userService.fetchOrganizations(); Set<String> existingJurisdictions = new HashSet<>(locationRepository.getAllLocationIds()); Set<String> existingPlans = planDefinitionRepository.findAllPlanDefinitionIds(); boolean newAssignments = hasNewAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions); UserAssignmentDTO removedAssignments = processRemovedAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions, existingPlans); if (newAssignments) { logoff(R.string.account_new_assignment_logged_off); resetSync(); } else if (removedAssignments.isRemoved()) { Intent intent = new Intent(); intent.setAction(ACTION_ASSIGNMENT_REMOVED); intent.putExtra(ASSIGNMENTS_REMOVED, removedAssignments); CoreLibrary.getInstance().context().applicationContext().sendBroadcast(intent); } } } catch (Exception e) { Timber.e(e); } } } | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmentDTO currentUserAssignment = gson.fromJson(assignment, UserAssignmentDTO.class); Set<Long> existingOrganizations = userService.fetchOrganizations(); Set<String> existingJurisdictions = new HashSet<>(locationRepository.getAllLocationIds()); Set<String> existingPlans = planDefinitionRepository.findAllPlanDefinitionIds(); boolean newAssignments = hasNewAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions); UserAssignmentDTO removedAssignments = processRemovedAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions, existingPlans); if (newAssignments) { logoff(R.string.account_new_assignment_logged_off); resetSync(); } else if (removedAssignments.isRemoved()) { Intent intent = new Intent(); intent.setAction(ACTION_ASSIGNMENT_REMOVED); intent.putExtra(ASSIGNMENTS_REMOVED, removedAssignments); CoreLibrary.getInstance().context().applicationContext().sendBroadcast(intent); } } } catch (Exception e) { Timber.e(e); } } ValidateAssignmentHelper(SyncUtils syncUtils); } | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmentDTO currentUserAssignment = gson.fromJson(assignment, UserAssignmentDTO.class); Set<Long> existingOrganizations = userService.fetchOrganizations(); Set<String> existingJurisdictions = new HashSet<>(locationRepository.getAllLocationIds()); Set<String> existingPlans = planDefinitionRepository.findAllPlanDefinitionIds(); boolean newAssignments = hasNewAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions); UserAssignmentDTO removedAssignments = processRemovedAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions, existingPlans); if (newAssignments) { logoff(R.string.account_new_assignment_logged_off); resetSync(); } else if (removedAssignments.isRemoved()) { Intent intent = new Intent(); intent.setAction(ACTION_ASSIGNMENT_REMOVED); intent.putExtra(ASSIGNMENTS_REMOVED, removedAssignments); CoreLibrary.getInstance().context().applicationContext().sendBroadcast(intent); } } } catch (Exception e) { Timber.e(e); } } ValidateAssignmentHelper(SyncUtils syncUtils); void validateUserAssignment(); } | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmentDTO currentUserAssignment = gson.fromJson(assignment, UserAssignmentDTO.class); Set<Long> existingOrganizations = userService.fetchOrganizations(); Set<String> existingJurisdictions = new HashSet<>(locationRepository.getAllLocationIds()); Set<String> existingPlans = planDefinitionRepository.findAllPlanDefinitionIds(); boolean newAssignments = hasNewAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions); UserAssignmentDTO removedAssignments = processRemovedAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions, existingPlans); if (newAssignments) { logoff(R.string.account_new_assignment_logged_off); resetSync(); } else if (removedAssignments.isRemoved()) { Intent intent = new Intent(); intent.setAction(ACTION_ASSIGNMENT_REMOVED); intent.putExtra(ASSIGNMENTS_REMOVED, removedAssignments); CoreLibrary.getInstance().context().applicationContext().sendBroadcast(intent); } } } catch (Exception e) { Timber.e(e); } } ValidateAssignmentHelper(SyncUtils syncUtils); void validateUserAssignment(); static final String ACTION_ASSIGNMENT_REMOVED; static final String ASSIGNMENTS_REMOVED; static final Gson gson; } |
@Test public void testValidateUserAssignmentShouldClearRemovedAssignments() throws Exception { when(allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED)).thenReturn(true); when(httpAgent.fetch(anyString())).thenReturn(new Response<>(ResponseStatus.success, gson.toJson(userAssignment))); Set<Long> organizations = new HashSet<>(Arrays.asList(1234L, 1235L)); List<String> jurisdictions = Arrays.asList("67c5e0a4-132f-457b-b573-9abf5ec95c75", "b4d3fbde-3686-4472-b3c4-7e28ba455168"); when(userService.fetchOrganizations()).thenReturn(organizations); when(locationRepository.getAllLocationIds()).thenReturn(new ArrayList<>(jurisdictions)); when(userService.fetchJurisdictionIds()).thenReturn(new HashSet<>(jurisdictions)); when(planDefinitionRepository.findAllPlanDefinitionIds()).thenReturn(new HashSet<>(Arrays.asList("plan1", "plan12"))); locationTree.deleteLocation("b4d3fbde-3686-4472-b3c4-7e28ba455168"); when(settingsRepository.fetchANMLocation()).thenReturn(gson.toJson(locationTree)); validateAssignmentHelper.validateUserAssignment(); verify(allSharedPreferences, never()).savePreference(anyString(), eq("0")); verify(allSharedPreferences, never()).saveLastSyncDate(0); verify(allSharedPreferences).getBooleanPreference(IS_KEYCLOAK_CONFIGURED); verify(httpAgent).fetch(anyString()); verify(planDefinitionRepository).findAllPlanDefinitionIds(); verify(locationRepository).getAllLocationIds(); verify(userService).fetchOrganizations(); verify(planDefinitionRepository).deletePlans(Collections.singleton("plan12")); verify(userService).saveOrganizations(new ArrayList<>(userAssignment.getOrganizationIds())); verify(locationRepository).deleteLocations(Collections.singleton("b4d3fbde-3686-4472-b3c4-7e28ba455168")); verify(userService).saveJurisdictionIds(userAssignment.getJurisdictions()); } | public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmentDTO currentUserAssignment = gson.fromJson(assignment, UserAssignmentDTO.class); Set<Long> existingOrganizations = userService.fetchOrganizations(); Set<String> existingJurisdictions = new HashSet<>(locationRepository.getAllLocationIds()); Set<String> existingPlans = planDefinitionRepository.findAllPlanDefinitionIds(); boolean newAssignments = hasNewAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions); UserAssignmentDTO removedAssignments = processRemovedAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions, existingPlans); if (newAssignments) { logoff(R.string.account_new_assignment_logged_off); resetSync(); } else if (removedAssignments.isRemoved()) { Intent intent = new Intent(); intent.setAction(ACTION_ASSIGNMENT_REMOVED); intent.putExtra(ASSIGNMENTS_REMOVED, removedAssignments); CoreLibrary.getInstance().context().applicationContext().sendBroadcast(intent); } } } catch (Exception e) { Timber.e(e); } } | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmentDTO currentUserAssignment = gson.fromJson(assignment, UserAssignmentDTO.class); Set<Long> existingOrganizations = userService.fetchOrganizations(); Set<String> existingJurisdictions = new HashSet<>(locationRepository.getAllLocationIds()); Set<String> existingPlans = planDefinitionRepository.findAllPlanDefinitionIds(); boolean newAssignments = hasNewAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions); UserAssignmentDTO removedAssignments = processRemovedAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions, existingPlans); if (newAssignments) { logoff(R.string.account_new_assignment_logged_off); resetSync(); } else if (removedAssignments.isRemoved()) { Intent intent = new Intent(); intent.setAction(ACTION_ASSIGNMENT_REMOVED); intent.putExtra(ASSIGNMENTS_REMOVED, removedAssignments); CoreLibrary.getInstance().context().applicationContext().sendBroadcast(intent); } } } catch (Exception e) { Timber.e(e); } } } | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmentDTO currentUserAssignment = gson.fromJson(assignment, UserAssignmentDTO.class); Set<Long> existingOrganizations = userService.fetchOrganizations(); Set<String> existingJurisdictions = new HashSet<>(locationRepository.getAllLocationIds()); Set<String> existingPlans = planDefinitionRepository.findAllPlanDefinitionIds(); boolean newAssignments = hasNewAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions); UserAssignmentDTO removedAssignments = processRemovedAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions, existingPlans); if (newAssignments) { logoff(R.string.account_new_assignment_logged_off); resetSync(); } else if (removedAssignments.isRemoved()) { Intent intent = new Intent(); intent.setAction(ACTION_ASSIGNMENT_REMOVED); intent.putExtra(ASSIGNMENTS_REMOVED, removedAssignments); CoreLibrary.getInstance().context().applicationContext().sendBroadcast(intent); } } } catch (Exception e) { Timber.e(e); } } ValidateAssignmentHelper(SyncUtils syncUtils); } | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmentDTO currentUserAssignment = gson.fromJson(assignment, UserAssignmentDTO.class); Set<Long> existingOrganizations = userService.fetchOrganizations(); Set<String> existingJurisdictions = new HashSet<>(locationRepository.getAllLocationIds()); Set<String> existingPlans = planDefinitionRepository.findAllPlanDefinitionIds(); boolean newAssignments = hasNewAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions); UserAssignmentDTO removedAssignments = processRemovedAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions, existingPlans); if (newAssignments) { logoff(R.string.account_new_assignment_logged_off); resetSync(); } else if (removedAssignments.isRemoved()) { Intent intent = new Intent(); intent.setAction(ACTION_ASSIGNMENT_REMOVED); intent.putExtra(ASSIGNMENTS_REMOVED, removedAssignments); CoreLibrary.getInstance().context().applicationContext().sendBroadcast(intent); } } } catch (Exception e) { Timber.e(e); } } ValidateAssignmentHelper(SyncUtils syncUtils); void validateUserAssignment(); } | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmentDTO currentUserAssignment = gson.fromJson(assignment, UserAssignmentDTO.class); Set<Long> existingOrganizations = userService.fetchOrganizations(); Set<String> existingJurisdictions = new HashSet<>(locationRepository.getAllLocationIds()); Set<String> existingPlans = planDefinitionRepository.findAllPlanDefinitionIds(); boolean newAssignments = hasNewAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions); UserAssignmentDTO removedAssignments = processRemovedAssignments(currentUserAssignment, existingOrganizations, existingJurisdictions, existingPlans); if (newAssignments) { logoff(R.string.account_new_assignment_logged_off); resetSync(); } else if (removedAssignments.isRemoved()) { Intent intent = new Intent(); intent.setAction(ACTION_ASSIGNMENT_REMOVED); intent.putExtra(ASSIGNMENTS_REMOVED, removedAssignments); CoreLibrary.getInstance().context().applicationContext().sendBroadcast(intent); } } } catch (Exception e) { Timber.e(e); } } ValidateAssignmentHelper(SyncUtils syncUtils); void validateUserAssignment(); static final String ACTION_ASSIGNMENT_REMOVED; static final String ASSIGNMENTS_REMOVED; static final Gson gson; } |
@Test public void testSaveAllClientsAndEventsShouldReturnFalseForNullParam() throws Exception { ECSyncHelper syncHelperSpy = Mockito.spy(syncHelper); boolean result = syncHelperSpy.saveAllClientsAndEvents(null); Assert.assertFalse(result); } | public boolean saveAllClientsAndEvents(JSONObject jsonObject) { try { if (jsonObject == null) { return false; } JSONArray events = jsonObject.has("events") ? jsonObject.getJSONArray("events") : new JSONArray(); JSONArray clients = jsonObject.has("clients") ? jsonObject.getJSONArray("clients") : new JSONArray(); batchSave(events, clients); return true; } catch (Exception e) { Timber.e(e); return false; } } | ECSyncHelper { public boolean saveAllClientsAndEvents(JSONObject jsonObject) { try { if (jsonObject == null) { return false; } JSONArray events = jsonObject.has("events") ? jsonObject.getJSONArray("events") : new JSONArray(); JSONArray clients = jsonObject.has("clients") ? jsonObject.getJSONArray("clients") : new JSONArray(); batchSave(events, clients); return true; } catch (Exception e) { Timber.e(e); return false; } } } | ECSyncHelper { public boolean saveAllClientsAndEvents(JSONObject jsonObject) { try { if (jsonObject == null) { return false; } JSONArray events = jsonObject.has("events") ? jsonObject.getJSONArray("events") : new JSONArray(); JSONArray clients = jsonObject.has("clients") ? jsonObject.getJSONArray("clients") : new JSONArray(); batchSave(events, clients); return true; } catch (Exception e) { Timber.e(e); return false; } } @VisibleForTesting protected ECSyncHelper(Context context, EventClientRepository eventClientRepository); } | ECSyncHelper { public boolean saveAllClientsAndEvents(JSONObject jsonObject) { try { if (jsonObject == null) { return false; } JSONArray events = jsonObject.has("events") ? jsonObject.getJSONArray("events") : new JSONArray(); JSONArray clients = jsonObject.has("clients") ? jsonObject.getJSONArray("clients") : new JSONArray(); batchSave(events, clients); return true; } catch (Exception e) { Timber.e(e); return false; } } @VisibleForTesting protected ECSyncHelper(Context context, EventClientRepository eventClientRepository); static ECSyncHelper getInstance(Context context); boolean saveAllClientsAndEvents(JSONObject jsonObject); List<EventClient> allEventClients(long startSyncTimeStamp, long lastSyncTimeStamp); long getLastSyncTimeStamp(); void updateLastSyncTimeStamp(long lastSyncTimeStamp); void updateLastCheckTimeStamp(long lastCheckTimeStamp); long getLastCheckTimeStamp(); void batchSave(JSONArray events, JSONArray clients); List<EventClient> getEvents(Date lastSyncDate, String syncStatus); List<EventClient> getEvents(List<String> formSubmissionIds); JSONObject getClient(String baseEntityId); void addClient(String baseEntityId, JSONObject jsonObject); void addEvent(String baseEntityId, JSONObject jsonObject); void addEvent(String baseEntityId, JSONObject jsonObject, String syncStatus); List<EventClient> allEvents(long startSyncTimeStamp, long lastSyncTimeStamp); void batchInsertClients(JSONArray clients); void batchInsertEvents(JSONArray events); T convert(JSONObject jo, Class<T> t); JSONObject convertToJson(Object object); boolean deleteClient(String baseEntityId); } | ECSyncHelper { public boolean saveAllClientsAndEvents(JSONObject jsonObject) { try { if (jsonObject == null) { return false; } JSONArray events = jsonObject.has("events") ? jsonObject.getJSONArray("events") : new JSONArray(); JSONArray clients = jsonObject.has("clients") ? jsonObject.getJSONArray("clients") : new JSONArray(); batchSave(events, clients); return true; } catch (Exception e) { Timber.e(e); return false; } } @VisibleForTesting protected ECSyncHelper(Context context, EventClientRepository eventClientRepository); static ECSyncHelper getInstance(Context context); boolean saveAllClientsAndEvents(JSONObject jsonObject); List<EventClient> allEventClients(long startSyncTimeStamp, long lastSyncTimeStamp); long getLastSyncTimeStamp(); void updateLastSyncTimeStamp(long lastSyncTimeStamp); void updateLastCheckTimeStamp(long lastCheckTimeStamp); long getLastCheckTimeStamp(); void batchSave(JSONArray events, JSONArray clients); List<EventClient> getEvents(Date lastSyncDate, String syncStatus); List<EventClient> getEvents(List<String> formSubmissionIds); JSONObject getClient(String baseEntityId); void addClient(String baseEntityId, JSONObject jsonObject); void addEvent(String baseEntityId, JSONObject jsonObject); void addEvent(String baseEntityId, JSONObject jsonObject, String syncStatus); List<EventClient> allEvents(long startSyncTimeStamp, long lastSyncTimeStamp); void batchInsertClients(JSONArray clients); void batchInsertEvents(JSONArray events); T convert(JSONObject jo, Class<T> t); JSONObject convertToJson(Object object); boolean deleteClient(String baseEntityId); } |
@Test public void testAllEventClientsInvokesRepositoryFetchEventClientsWithCorrectParams() { ECSyncHelper syncHelperSpy = Mockito.spy(syncHelper); Mockito.doReturn(null).when(eventClientRepository).fetchEventClients(DUMMY_LONG, DUMMY_LONG); List<EventClient> result = syncHelperSpy.allEventClients(DUMMY_LONG, DUMMY_LONG); Assert.assertNull(result); Mockito.verify(eventClientRepository).fetchEventClients(DUMMY_LONG, DUMMY_LONG); EventClientRepository eventClientRepository = null; Whitebox.setInternalState(syncHelperSpy, EVENT_CLIENT_REPOSITORY, eventClientRepository); result = syncHelperSpy.allEventClients(DUMMY_LONG, DUMMY_LONG); Assert.assertNotNull(result); Assert.assertTrue(result.isEmpty()); } | public List<EventClient> allEventClients(long startSyncTimeStamp, long lastSyncTimeStamp) { try { return eventClientRepository.fetchEventClients(startSyncTimeStamp, lastSyncTimeStamp); } catch (Exception e) { Timber.e(e); } return new ArrayList<>(); } | ECSyncHelper { public List<EventClient> allEventClients(long startSyncTimeStamp, long lastSyncTimeStamp) { try { return eventClientRepository.fetchEventClients(startSyncTimeStamp, lastSyncTimeStamp); } catch (Exception e) { Timber.e(e); } return new ArrayList<>(); } } | ECSyncHelper { public List<EventClient> allEventClients(long startSyncTimeStamp, long lastSyncTimeStamp) { try { return eventClientRepository.fetchEventClients(startSyncTimeStamp, lastSyncTimeStamp); } catch (Exception e) { Timber.e(e); } return new ArrayList<>(); } @VisibleForTesting protected ECSyncHelper(Context context, EventClientRepository eventClientRepository); } | ECSyncHelper { public List<EventClient> allEventClients(long startSyncTimeStamp, long lastSyncTimeStamp) { try { return eventClientRepository.fetchEventClients(startSyncTimeStamp, lastSyncTimeStamp); } catch (Exception e) { Timber.e(e); } return new ArrayList<>(); } @VisibleForTesting protected ECSyncHelper(Context context, EventClientRepository eventClientRepository); static ECSyncHelper getInstance(Context context); boolean saveAllClientsAndEvents(JSONObject jsonObject); List<EventClient> allEventClients(long startSyncTimeStamp, long lastSyncTimeStamp); long getLastSyncTimeStamp(); void updateLastSyncTimeStamp(long lastSyncTimeStamp); void updateLastCheckTimeStamp(long lastCheckTimeStamp); long getLastCheckTimeStamp(); void batchSave(JSONArray events, JSONArray clients); List<EventClient> getEvents(Date lastSyncDate, String syncStatus); List<EventClient> getEvents(List<String> formSubmissionIds); JSONObject getClient(String baseEntityId); void addClient(String baseEntityId, JSONObject jsonObject); void addEvent(String baseEntityId, JSONObject jsonObject); void addEvent(String baseEntityId, JSONObject jsonObject, String syncStatus); List<EventClient> allEvents(long startSyncTimeStamp, long lastSyncTimeStamp); void batchInsertClients(JSONArray clients); void batchInsertEvents(JSONArray events); T convert(JSONObject jo, Class<T> t); JSONObject convertToJson(Object object); boolean deleteClient(String baseEntityId); } | ECSyncHelper { public List<EventClient> allEventClients(long startSyncTimeStamp, long lastSyncTimeStamp) { try { return eventClientRepository.fetchEventClients(startSyncTimeStamp, lastSyncTimeStamp); } catch (Exception e) { Timber.e(e); } return new ArrayList<>(); } @VisibleForTesting protected ECSyncHelper(Context context, EventClientRepository eventClientRepository); static ECSyncHelper getInstance(Context context); boolean saveAllClientsAndEvents(JSONObject jsonObject); List<EventClient> allEventClients(long startSyncTimeStamp, long lastSyncTimeStamp); long getLastSyncTimeStamp(); void updateLastSyncTimeStamp(long lastSyncTimeStamp); void updateLastCheckTimeStamp(long lastCheckTimeStamp); long getLastCheckTimeStamp(); void batchSave(JSONArray events, JSONArray clients); List<EventClient> getEvents(Date lastSyncDate, String syncStatus); List<EventClient> getEvents(List<String> formSubmissionIds); JSONObject getClient(String baseEntityId); void addClient(String baseEntityId, JSONObject jsonObject); void addEvent(String baseEntityId, JSONObject jsonObject); void addEvent(String baseEntityId, JSONObject jsonObject, String syncStatus); List<EventClient> allEvents(long startSyncTimeStamp, long lastSyncTimeStamp); void batchInsertClients(JSONArray clients); void batchInsertEvents(JSONArray events); T convert(JSONObject jo, Class<T> t); JSONObject convertToJson(Object object); boolean deleteClient(String baseEntityId); } |
@Test public void assertWriteWritesSuccessfully() throws Exception { String testData = "string to write"; when(Environment.getExternalStorageDirectory()).thenReturn(existentDirectory); PowerMockito.whenNew(BufferedWriter.class).withAnyArguments().thenReturn(mockWriter); FileUtilities fileUtils = new FileUtilities(); try { fileUtils.write(FILE_NAME, testData); String path = existentDirectory.getPath() + File.separator + "EZ_time_tracker" + File.separator + FILE_NAME; File file = new File(path); final String writenText = FileUtils.readFileToString(file); Assert.assertEquals(testData, writenText); } catch (Exception e) { Assert.fail(); } } | public void write(String fileName, String data) { File root = Environment.getExternalStorageDirectory(); File outDir = new File(root.getAbsolutePath() + File.separator + "EZ_time_tracker"); if (!outDir.isDirectory()) { outDir.mkdir(); } try { if (!outDir.isDirectory()) { throw new IOException("Unable to create directory EZ_time_tracker. Maybe the SD " + "card is mounted?"); } File outputFile = new File(outDir, fileName); writer = new BufferedWriter(new FileWriter(outputFile)); writer.write(data); writer.close(); } catch (IOException e) { Timber.w(e); } } | FileUtilities { public void write(String fileName, String data) { File root = Environment.getExternalStorageDirectory(); File outDir = new File(root.getAbsolutePath() + File.separator + "EZ_time_tracker"); if (!outDir.isDirectory()) { outDir.mkdir(); } try { if (!outDir.isDirectory()) { throw new IOException("Unable to create directory EZ_time_tracker. Maybe the SD " + "card is mounted?"); } File outputFile = new File(outDir, fileName); writer = new BufferedWriter(new FileWriter(outputFile)); writer.write(data); writer.close(); } catch (IOException e) { Timber.w(e); } } } | FileUtilities { public void write(String fileName, String data) { File root = Environment.getExternalStorageDirectory(); File outDir = new File(root.getAbsolutePath() + File.separator + "EZ_time_tracker"); if (!outDir.isDirectory()) { outDir.mkdir(); } try { if (!outDir.isDirectory()) { throw new IOException("Unable to create directory EZ_time_tracker. Maybe the SD " + "card is mounted?"); } File outputFile = new File(outDir, fileName); writer = new BufferedWriter(new FileWriter(outputFile)); writer.write(data); writer.close(); } catch (IOException e) { Timber.w(e); } } FileUtilities(); } | FileUtilities { public void write(String fileName, String data) { File root = Environment.getExternalStorageDirectory(); File outDir = new File(root.getAbsolutePath() + File.separator + "EZ_time_tracker"); if (!outDir.isDirectory()) { outDir.mkdir(); } try { if (!outDir.isDirectory()) { throw new IOException("Unable to create directory EZ_time_tracker. Maybe the SD " + "card is mounted?"); } File outputFile = new File(outDir, fileName); writer = new BufferedWriter(new FileWriter(outputFile)); writer.write(data); writer.close(); } catch (IOException e) { Timber.w(e); } } FileUtilities(); static Bitmap retrieveStaticImageFromDisk(String fileName); static String getFileExtension(String fileName); static String getUserAgent(Context mContext); static String getImageUrl(String entityID); void write(String fileName, String data); Writer getWriter(); String getAbsolutePath(); } | FileUtilities { public void write(String fileName, String data) { File root = Environment.getExternalStorageDirectory(); File outDir = new File(root.getAbsolutePath() + File.separator + "EZ_time_tracker"); if (!outDir.isDirectory()) { outDir.mkdir(); } try { if (!outDir.isDirectory()) { throw new IOException("Unable to create directory EZ_time_tracker. Maybe the SD " + "card is mounted?"); } File outputFile = new File(outDir, fileName); writer = new BufferedWriter(new FileWriter(outputFile)); writer.write(data); writer.close(); } catch (IOException e) { Timber.w(e); } } FileUtilities(); static Bitmap retrieveStaticImageFromDisk(String fileName); static String getFileExtension(String fileName); static String getUserAgent(Context mContext); static String getImageUrl(String entityID); void write(String fileName, String data); Writer getWriter(); String getAbsolutePath(); } |
@Test public void fetchOpenMrsLocationsByTeamIds() throws JSONException, NoHttpResponseException { Mockito.doReturn(new Response<>(ResponseStatus.success, "[{\"locations\":[{\"display\":\"Tabata Dampo - Unified\",\"uuid\":\"fb7ed5db-138d-4e6f-94d8-bc443b58dadb\"}]," + "\"team\":{\"location\":{\"display\":\"Madona - Unified\",\"uuid\":\"bcf5a36d-fb53-4de9-9813-01f1d480e3fe\"}}}]")) .when(httpAgent).post(Mockito.anyString(), Mockito.anyString()); locationServiceHelper.fetchOpenMrsLocationsByTeamIds(); Mockito.verify(locationRepository, Mockito.atLeastOnce()).addOrUpdate(Mockito.any(Location.class)); Mockito.verify(locationTagRepository, Mockito.atLeastOnce()).addOrUpdate(Mockito.any(LocationTag.class)); } | public void fetchOpenMrsLocationsByTeamIds() throws NoHttpResponseException, JSONException { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(OPENMRS_LOCATION_BY_TEAM_IDS + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); Response resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, OPENMRS_LOCATION_BY_TEAM_IDS), new JSONArray().put(allSharedPreferences.fetchDefaultLocalityId( allSharedPreferences.fetchRegisteredANM())).toString()); if (resp.isFailure()) { throw new NoHttpResponseException(OPENMRS_LOCATION_BY_TEAM_IDS + " not returned data"); } Timber.i(resp.payload().toString()); JSONArray teamLocations = new JSONArray(resp.payload().toString()); for (int index = 0; index < teamLocations.length(); index++) { JSONObject openMrsLocation = teamLocations.getJSONObject(index); if (openMrsLocation.has(LOCATIONS) && openMrsLocation.has(TEAM)) { JSONArray actualLocations = openMrsLocation.getJSONArray(LOCATIONS); saveOpenMrsTeamLocation(openMrsLocation, actualLocations); } } } | LocationServiceHelper extends BaseHelper { public void fetchOpenMrsLocationsByTeamIds() throws NoHttpResponseException, JSONException { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(OPENMRS_LOCATION_BY_TEAM_IDS + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); Response resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, OPENMRS_LOCATION_BY_TEAM_IDS), new JSONArray().put(allSharedPreferences.fetchDefaultLocalityId( allSharedPreferences.fetchRegisteredANM())).toString()); if (resp.isFailure()) { throw new NoHttpResponseException(OPENMRS_LOCATION_BY_TEAM_IDS + " not returned data"); } Timber.i(resp.payload().toString()); JSONArray teamLocations = new JSONArray(resp.payload().toString()); for (int index = 0; index < teamLocations.length(); index++) { JSONObject openMrsLocation = teamLocations.getJSONObject(index); if (openMrsLocation.has(LOCATIONS) && openMrsLocation.has(TEAM)) { JSONArray actualLocations = openMrsLocation.getJSONArray(LOCATIONS); saveOpenMrsTeamLocation(openMrsLocation, actualLocations); } } } } | LocationServiceHelper extends BaseHelper { public void fetchOpenMrsLocationsByTeamIds() throws NoHttpResponseException, JSONException { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(OPENMRS_LOCATION_BY_TEAM_IDS + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); Response resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, OPENMRS_LOCATION_BY_TEAM_IDS), new JSONArray().put(allSharedPreferences.fetchDefaultLocalityId( allSharedPreferences.fetchRegisteredANM())).toString()); if (resp.isFailure()) { throw new NoHttpResponseException(OPENMRS_LOCATION_BY_TEAM_IDS + " not returned data"); } Timber.i(resp.payload().toString()); JSONArray teamLocations = new JSONArray(resp.payload().toString()); for (int index = 0; index < teamLocations.length(); index++) { JSONObject openMrsLocation = teamLocations.getJSONObject(index); if (openMrsLocation.has(LOCATIONS) && openMrsLocation.has(TEAM)) { JSONArray actualLocations = openMrsLocation.getJSONArray(LOCATIONS); saveOpenMrsTeamLocation(openMrsLocation, actualLocations); } } } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); } | LocationServiceHelper extends BaseHelper { public void fetchOpenMrsLocationsByTeamIds() throws NoHttpResponseException, JSONException { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(OPENMRS_LOCATION_BY_TEAM_IDS + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); Response resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, OPENMRS_LOCATION_BY_TEAM_IDS), new JSONArray().put(allSharedPreferences.fetchDefaultLocalityId( allSharedPreferences.fetchRegisteredANM())).toString()); if (resp.isFailure()) { throw new NoHttpResponseException(OPENMRS_LOCATION_BY_TEAM_IDS + " not returned data"); } Timber.i(resp.payload().toString()); JSONArray teamLocations = new JSONArray(resp.payload().toString()); for (int index = 0; index < teamLocations.length(); index++) { JSONObject openMrsLocation = teamLocations.getJSONObject(index); if (openMrsLocation.has(LOCATIONS) && openMrsLocation.has(TEAM)) { JSONArray actualLocations = openMrsLocation.getJSONArray(LOCATIONS); saveOpenMrsTeamLocation(openMrsLocation, actualLocations); } } } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); static LocationServiceHelper getInstance(); List<Location> fetchLocationsStructures(); void fetchLocationsByLevelAndTags(); SyncConfiguration getSyncConfiguration(); void syncCreatedStructureToServer(); void syncUpdatedLocationsToServer(); void fetchOpenMrsLocationsByTeamIds(); HTTPAgent getHttpAgent(); @NotNull String getFormattedBaseUrl(); void fetchAllLocations(); } | LocationServiceHelper extends BaseHelper { public void fetchOpenMrsLocationsByTeamIds() throws NoHttpResponseException, JSONException { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(OPENMRS_LOCATION_BY_TEAM_IDS + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); Response resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, OPENMRS_LOCATION_BY_TEAM_IDS), new JSONArray().put(allSharedPreferences.fetchDefaultLocalityId( allSharedPreferences.fetchRegisteredANM())).toString()); if (resp.isFailure()) { throw new NoHttpResponseException(OPENMRS_LOCATION_BY_TEAM_IDS + " not returned data"); } Timber.i(resp.payload().toString()); JSONArray teamLocations = new JSONArray(resp.payload().toString()); for (int index = 0; index < teamLocations.length(); index++) { JSONObject openMrsLocation = teamLocations.getJSONObject(index); if (openMrsLocation.has(LOCATIONS) && openMrsLocation.has(TEAM)) { JSONArray actualLocations = openMrsLocation.getJSONArray(LOCATIONS); saveOpenMrsTeamLocation(openMrsLocation, actualLocations); } } } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); static LocationServiceHelper getInstance(); List<Location> fetchLocationsStructures(); void fetchLocationsByLevelAndTags(); SyncConfiguration getSyncConfiguration(); void syncCreatedStructureToServer(); void syncUpdatedLocationsToServer(); void fetchOpenMrsLocationsByTeamIds(); HTTPAgent getHttpAgent(); @NotNull String getFormattedBaseUrl(); void fetchAllLocations(); static final String LOCATION_STRUCTURE_URL; static final String CREATE_STRUCTURE_URL; static final String COMMON_LOCATIONS_SERVICE_URL; static final String OPENMRS_LOCATION_BY_TEAM_IDS; static final String STRUCTURES_LAST_SYNC_DATE; static final String LOCATION_LAST_SYNC_DATE; static Gson locationGson; } |
@Test(expected = NoHttpResponseException.class) public void shouldThrowExceptionWhenThereIsFailureInResponse() throws JSONException, NoHttpResponseException { Mockito.doReturn(new Response<>(ResponseStatus.failure, "error")) .when(httpAgent).post(Mockito.anyString(), Mockito.anyString()); locationServiceHelper.fetchOpenMrsLocationsByTeamIds(); Mockito.verify(locationRepository, Mockito.atLeastOnce()).addOrUpdate(Mockito.any(Location.class)); Mockito.verify(locationTagRepository, Mockito.atLeastOnce()).addOrUpdate(Mockito.any(LocationTag.class)); } | public void fetchOpenMrsLocationsByTeamIds() throws NoHttpResponseException, JSONException { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(OPENMRS_LOCATION_BY_TEAM_IDS + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); Response resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, OPENMRS_LOCATION_BY_TEAM_IDS), new JSONArray().put(allSharedPreferences.fetchDefaultLocalityId( allSharedPreferences.fetchRegisteredANM())).toString()); if (resp.isFailure()) { throw new NoHttpResponseException(OPENMRS_LOCATION_BY_TEAM_IDS + " not returned data"); } Timber.i(resp.payload().toString()); JSONArray teamLocations = new JSONArray(resp.payload().toString()); for (int index = 0; index < teamLocations.length(); index++) { JSONObject openMrsLocation = teamLocations.getJSONObject(index); if (openMrsLocation.has(LOCATIONS) && openMrsLocation.has(TEAM)) { JSONArray actualLocations = openMrsLocation.getJSONArray(LOCATIONS); saveOpenMrsTeamLocation(openMrsLocation, actualLocations); } } } | LocationServiceHelper extends BaseHelper { public void fetchOpenMrsLocationsByTeamIds() throws NoHttpResponseException, JSONException { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(OPENMRS_LOCATION_BY_TEAM_IDS + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); Response resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, OPENMRS_LOCATION_BY_TEAM_IDS), new JSONArray().put(allSharedPreferences.fetchDefaultLocalityId( allSharedPreferences.fetchRegisteredANM())).toString()); if (resp.isFailure()) { throw new NoHttpResponseException(OPENMRS_LOCATION_BY_TEAM_IDS + " not returned data"); } Timber.i(resp.payload().toString()); JSONArray teamLocations = new JSONArray(resp.payload().toString()); for (int index = 0; index < teamLocations.length(); index++) { JSONObject openMrsLocation = teamLocations.getJSONObject(index); if (openMrsLocation.has(LOCATIONS) && openMrsLocation.has(TEAM)) { JSONArray actualLocations = openMrsLocation.getJSONArray(LOCATIONS); saveOpenMrsTeamLocation(openMrsLocation, actualLocations); } } } } | LocationServiceHelper extends BaseHelper { public void fetchOpenMrsLocationsByTeamIds() throws NoHttpResponseException, JSONException { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(OPENMRS_LOCATION_BY_TEAM_IDS + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); Response resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, OPENMRS_LOCATION_BY_TEAM_IDS), new JSONArray().put(allSharedPreferences.fetchDefaultLocalityId( allSharedPreferences.fetchRegisteredANM())).toString()); if (resp.isFailure()) { throw new NoHttpResponseException(OPENMRS_LOCATION_BY_TEAM_IDS + " not returned data"); } Timber.i(resp.payload().toString()); JSONArray teamLocations = new JSONArray(resp.payload().toString()); for (int index = 0; index < teamLocations.length(); index++) { JSONObject openMrsLocation = teamLocations.getJSONObject(index); if (openMrsLocation.has(LOCATIONS) && openMrsLocation.has(TEAM)) { JSONArray actualLocations = openMrsLocation.getJSONArray(LOCATIONS); saveOpenMrsTeamLocation(openMrsLocation, actualLocations); } } } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); } | LocationServiceHelper extends BaseHelper { public void fetchOpenMrsLocationsByTeamIds() throws NoHttpResponseException, JSONException { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(OPENMRS_LOCATION_BY_TEAM_IDS + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); Response resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, OPENMRS_LOCATION_BY_TEAM_IDS), new JSONArray().put(allSharedPreferences.fetchDefaultLocalityId( allSharedPreferences.fetchRegisteredANM())).toString()); if (resp.isFailure()) { throw new NoHttpResponseException(OPENMRS_LOCATION_BY_TEAM_IDS + " not returned data"); } Timber.i(resp.payload().toString()); JSONArray teamLocations = new JSONArray(resp.payload().toString()); for (int index = 0; index < teamLocations.length(); index++) { JSONObject openMrsLocation = teamLocations.getJSONObject(index); if (openMrsLocation.has(LOCATIONS) && openMrsLocation.has(TEAM)) { JSONArray actualLocations = openMrsLocation.getJSONArray(LOCATIONS); saveOpenMrsTeamLocation(openMrsLocation, actualLocations); } } } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); static LocationServiceHelper getInstance(); List<Location> fetchLocationsStructures(); void fetchLocationsByLevelAndTags(); SyncConfiguration getSyncConfiguration(); void syncCreatedStructureToServer(); void syncUpdatedLocationsToServer(); void fetchOpenMrsLocationsByTeamIds(); HTTPAgent getHttpAgent(); @NotNull String getFormattedBaseUrl(); void fetchAllLocations(); } | LocationServiceHelper extends BaseHelper { public void fetchOpenMrsLocationsByTeamIds() throws NoHttpResponseException, JSONException { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(OPENMRS_LOCATION_BY_TEAM_IDS + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); Response resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, OPENMRS_LOCATION_BY_TEAM_IDS), new JSONArray().put(allSharedPreferences.fetchDefaultLocalityId( allSharedPreferences.fetchRegisteredANM())).toString()); if (resp.isFailure()) { throw new NoHttpResponseException(OPENMRS_LOCATION_BY_TEAM_IDS + " not returned data"); } Timber.i(resp.payload().toString()); JSONArray teamLocations = new JSONArray(resp.payload().toString()); for (int index = 0; index < teamLocations.length(); index++) { JSONObject openMrsLocation = teamLocations.getJSONObject(index); if (openMrsLocation.has(LOCATIONS) && openMrsLocation.has(TEAM)) { JSONArray actualLocations = openMrsLocation.getJSONArray(LOCATIONS); saveOpenMrsTeamLocation(openMrsLocation, actualLocations); } } } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); static LocationServiceHelper getInstance(); List<Location> fetchLocationsStructures(); void fetchLocationsByLevelAndTags(); SyncConfiguration getSyncConfiguration(); void syncCreatedStructureToServer(); void syncUpdatedLocationsToServer(); void fetchOpenMrsLocationsByTeamIds(); HTTPAgent getHttpAgent(); @NotNull String getFormattedBaseUrl(); void fetchAllLocations(); static final String LOCATION_STRUCTURE_URL; static final String CREATE_STRUCTURE_URL; static final String COMMON_LOCATIONS_SERVICE_URL; static final String OPENMRS_LOCATION_BY_TEAM_IDS; static final String STRUCTURES_LAST_SYNC_DATE; static final String LOCATION_LAST_SYNC_DATE; static Gson locationGson; } |
@Test public void fetchLocationsByLevelAndTags() throws Exception { Mockito.doReturn(new Response<>(ResponseStatus.success, "[{\"locationId\":\"b949c2b5-d5f6-4a1b-ad03-e82e7abbd47c\",\"name\":\"Ebrahim Haji - Unified\"," + "\"parentLocation\":{\"locationId\":\"620e3393-38aa-4797-85c4-3427cc882e00\",\"name\":\"Ilala MC - Unified\"," + "\"voided\":false},\"tags\":[\"Facility\"],\"voided\":false},{\"locationId\":\"bcf5a36d-fb53-4de9-9813-01f1d480e3fe\"," + "\"name\":\"Madona - Unified\",\"parentLocation\":{\"locationId\":\"620e3393-38aa-4797-85c4-3427cc882e00\"," + "\"name\":\"Ilala MC - Unified\",\"voided\":false},\"tags\":[\"Facility\"],\"voided\":false}]")) .when(httpAgent).post(Mockito.anyString(), Mockito.anyString()); locationServiceHelper.fetchLocationsByLevelAndTags(); Mockito.verify(locationRepository, Mockito.atLeastOnce()).addOrUpdate(Mockito.any(Location.class)); Mockito.verify(locationTagRepository, Mockito.atLeastOnce()).addOrUpdate(Mockito.any(LocationTag.class)); } | public void fetchLocationsByLevelAndTags() throws Exception { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(COMMON_LOCATIONS_SERVICE_URL + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); SyncConfiguration configs = getSyncConfiguration(); JSONObject requestPayload = new JSONObject(); requestPayload.put("locationUUID", allSharedPreferences.fetchDefaultLocalityId(allSharedPreferences.fetchRegisteredANM())); requestPayload.put("locationTopLevel", configs.getTopAllowedLocationLevel()); requestPayload.put("locationTagsQueried", new JSONArray(new Gson().toJson(configs.getSynchronizedLocationTags()))); Response<String> resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, COMMON_LOCATIONS_SERVICE_URL), requestPayload.toString()); if (resp.isFailure()) { throw new NoHttpResponseException(COMMON_LOCATIONS_SERVICE_URL + " not returned data"); } List<org.smartregister.domain.jsonmapping.Location> receivedOpenMrsLocations = new Gson().fromJson(resp.payload(), new TypeToken<List<org.smartregister.domain.jsonmapping.Location>>() { }.getType()); for (org.smartregister.domain.jsonmapping.Location openMrsLocation : receivedOpenMrsLocations) { Location location = new Location(); location.setId(openMrsLocation.getLocationId()); LocationProperty property = new LocationProperty(); property.setUid(openMrsLocation.getLocationId()); property.setParentId(openMrsLocation.getParentLocation().getLocationId()); property.setName(openMrsLocation.getName()); location.setProperties(property); locationRepository.addOrUpdate(location); for (String tagName : openMrsLocation.getTags()) { LocationTag locationTag = new LocationTag(); locationTag.setLocationId(openMrsLocation.getLocationId()); locationTag.setName(tagName); locationTagRepository.addOrUpdate(locationTag); } } } | LocationServiceHelper extends BaseHelper { public void fetchLocationsByLevelAndTags() throws Exception { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(COMMON_LOCATIONS_SERVICE_URL + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); SyncConfiguration configs = getSyncConfiguration(); JSONObject requestPayload = new JSONObject(); requestPayload.put("locationUUID", allSharedPreferences.fetchDefaultLocalityId(allSharedPreferences.fetchRegisteredANM())); requestPayload.put("locationTopLevel", configs.getTopAllowedLocationLevel()); requestPayload.put("locationTagsQueried", new JSONArray(new Gson().toJson(configs.getSynchronizedLocationTags()))); Response<String> resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, COMMON_LOCATIONS_SERVICE_URL), requestPayload.toString()); if (resp.isFailure()) { throw new NoHttpResponseException(COMMON_LOCATIONS_SERVICE_URL + " not returned data"); } List<org.smartregister.domain.jsonmapping.Location> receivedOpenMrsLocations = new Gson().fromJson(resp.payload(), new TypeToken<List<org.smartregister.domain.jsonmapping.Location>>() { }.getType()); for (org.smartregister.domain.jsonmapping.Location openMrsLocation : receivedOpenMrsLocations) { Location location = new Location(); location.setId(openMrsLocation.getLocationId()); LocationProperty property = new LocationProperty(); property.setUid(openMrsLocation.getLocationId()); property.setParentId(openMrsLocation.getParentLocation().getLocationId()); property.setName(openMrsLocation.getName()); location.setProperties(property); locationRepository.addOrUpdate(location); for (String tagName : openMrsLocation.getTags()) { LocationTag locationTag = new LocationTag(); locationTag.setLocationId(openMrsLocation.getLocationId()); locationTag.setName(tagName); locationTagRepository.addOrUpdate(locationTag); } } } } | LocationServiceHelper extends BaseHelper { public void fetchLocationsByLevelAndTags() throws Exception { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(COMMON_LOCATIONS_SERVICE_URL + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); SyncConfiguration configs = getSyncConfiguration(); JSONObject requestPayload = new JSONObject(); requestPayload.put("locationUUID", allSharedPreferences.fetchDefaultLocalityId(allSharedPreferences.fetchRegisteredANM())); requestPayload.put("locationTopLevel", configs.getTopAllowedLocationLevel()); requestPayload.put("locationTagsQueried", new JSONArray(new Gson().toJson(configs.getSynchronizedLocationTags()))); Response<String> resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, COMMON_LOCATIONS_SERVICE_URL), requestPayload.toString()); if (resp.isFailure()) { throw new NoHttpResponseException(COMMON_LOCATIONS_SERVICE_URL + " not returned data"); } List<org.smartregister.domain.jsonmapping.Location> receivedOpenMrsLocations = new Gson().fromJson(resp.payload(), new TypeToken<List<org.smartregister.domain.jsonmapping.Location>>() { }.getType()); for (org.smartregister.domain.jsonmapping.Location openMrsLocation : receivedOpenMrsLocations) { Location location = new Location(); location.setId(openMrsLocation.getLocationId()); LocationProperty property = new LocationProperty(); property.setUid(openMrsLocation.getLocationId()); property.setParentId(openMrsLocation.getParentLocation().getLocationId()); property.setName(openMrsLocation.getName()); location.setProperties(property); locationRepository.addOrUpdate(location); for (String tagName : openMrsLocation.getTags()) { LocationTag locationTag = new LocationTag(); locationTag.setLocationId(openMrsLocation.getLocationId()); locationTag.setName(tagName); locationTagRepository.addOrUpdate(locationTag); } } } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); } | LocationServiceHelper extends BaseHelper { public void fetchLocationsByLevelAndTags() throws Exception { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(COMMON_LOCATIONS_SERVICE_URL + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); SyncConfiguration configs = getSyncConfiguration(); JSONObject requestPayload = new JSONObject(); requestPayload.put("locationUUID", allSharedPreferences.fetchDefaultLocalityId(allSharedPreferences.fetchRegisteredANM())); requestPayload.put("locationTopLevel", configs.getTopAllowedLocationLevel()); requestPayload.put("locationTagsQueried", new JSONArray(new Gson().toJson(configs.getSynchronizedLocationTags()))); Response<String> resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, COMMON_LOCATIONS_SERVICE_URL), requestPayload.toString()); if (resp.isFailure()) { throw new NoHttpResponseException(COMMON_LOCATIONS_SERVICE_URL + " not returned data"); } List<org.smartregister.domain.jsonmapping.Location> receivedOpenMrsLocations = new Gson().fromJson(resp.payload(), new TypeToken<List<org.smartregister.domain.jsonmapping.Location>>() { }.getType()); for (org.smartregister.domain.jsonmapping.Location openMrsLocation : receivedOpenMrsLocations) { Location location = new Location(); location.setId(openMrsLocation.getLocationId()); LocationProperty property = new LocationProperty(); property.setUid(openMrsLocation.getLocationId()); property.setParentId(openMrsLocation.getParentLocation().getLocationId()); property.setName(openMrsLocation.getName()); location.setProperties(property); locationRepository.addOrUpdate(location); for (String tagName : openMrsLocation.getTags()) { LocationTag locationTag = new LocationTag(); locationTag.setLocationId(openMrsLocation.getLocationId()); locationTag.setName(tagName); locationTagRepository.addOrUpdate(locationTag); } } } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); static LocationServiceHelper getInstance(); List<Location> fetchLocationsStructures(); void fetchLocationsByLevelAndTags(); SyncConfiguration getSyncConfiguration(); void syncCreatedStructureToServer(); void syncUpdatedLocationsToServer(); void fetchOpenMrsLocationsByTeamIds(); HTTPAgent getHttpAgent(); @NotNull String getFormattedBaseUrl(); void fetchAllLocations(); } | LocationServiceHelper extends BaseHelper { public void fetchLocationsByLevelAndTags() throws Exception { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(COMMON_LOCATIONS_SERVICE_URL + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); SyncConfiguration configs = getSyncConfiguration(); JSONObject requestPayload = new JSONObject(); requestPayload.put("locationUUID", allSharedPreferences.fetchDefaultLocalityId(allSharedPreferences.fetchRegisteredANM())); requestPayload.put("locationTopLevel", configs.getTopAllowedLocationLevel()); requestPayload.put("locationTagsQueried", new JSONArray(new Gson().toJson(configs.getSynchronizedLocationTags()))); Response<String> resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, COMMON_LOCATIONS_SERVICE_URL), requestPayload.toString()); if (resp.isFailure()) { throw new NoHttpResponseException(COMMON_LOCATIONS_SERVICE_URL + " not returned data"); } List<org.smartregister.domain.jsonmapping.Location> receivedOpenMrsLocations = new Gson().fromJson(resp.payload(), new TypeToken<List<org.smartregister.domain.jsonmapping.Location>>() { }.getType()); for (org.smartregister.domain.jsonmapping.Location openMrsLocation : receivedOpenMrsLocations) { Location location = new Location(); location.setId(openMrsLocation.getLocationId()); LocationProperty property = new LocationProperty(); property.setUid(openMrsLocation.getLocationId()); property.setParentId(openMrsLocation.getParentLocation().getLocationId()); property.setName(openMrsLocation.getName()); location.setProperties(property); locationRepository.addOrUpdate(location); for (String tagName : openMrsLocation.getTags()) { LocationTag locationTag = new LocationTag(); locationTag.setLocationId(openMrsLocation.getLocationId()); locationTag.setName(tagName); locationTagRepository.addOrUpdate(locationTag); } } } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); static LocationServiceHelper getInstance(); List<Location> fetchLocationsStructures(); void fetchLocationsByLevelAndTags(); SyncConfiguration getSyncConfiguration(); void syncCreatedStructureToServer(); void syncUpdatedLocationsToServer(); void fetchOpenMrsLocationsByTeamIds(); HTTPAgent getHttpAgent(); @NotNull String getFormattedBaseUrl(); void fetchAllLocations(); static final String LOCATION_STRUCTURE_URL; static final String CREATE_STRUCTURE_URL; static final String COMMON_LOCATIONS_SERVICE_URL; static final String OPENMRS_LOCATION_BY_TEAM_IDS; static final String STRUCTURES_LAST_SYNC_DATE; static final String LOCATION_LAST_SYNC_DATE; static Gson locationGson; } |
@Test(expected = NoHttpResponseException.class) public void shouldThrowExceptionWhenFetchLocationsByLevelAndTagsReturnsFailedResponse() throws Exception { Mockito.doReturn(new Response<>(ResponseStatus.failure, "error")) .when(httpAgent).post(Mockito.anyString(), Mockito.anyString()); locationServiceHelper.fetchLocationsByLevelAndTags(); Mockito.verify(locationRepository, Mockito.atLeastOnce()).addOrUpdate(Mockito.any(Location.class)); Mockito.verify(locationTagRepository, Mockito.atLeastOnce()).addOrUpdate(Mockito.any(LocationTag.class)); } | public void fetchLocationsByLevelAndTags() throws Exception { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(COMMON_LOCATIONS_SERVICE_URL + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); SyncConfiguration configs = getSyncConfiguration(); JSONObject requestPayload = new JSONObject(); requestPayload.put("locationUUID", allSharedPreferences.fetchDefaultLocalityId(allSharedPreferences.fetchRegisteredANM())); requestPayload.put("locationTopLevel", configs.getTopAllowedLocationLevel()); requestPayload.put("locationTagsQueried", new JSONArray(new Gson().toJson(configs.getSynchronizedLocationTags()))); Response<String> resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, COMMON_LOCATIONS_SERVICE_URL), requestPayload.toString()); if (resp.isFailure()) { throw new NoHttpResponseException(COMMON_LOCATIONS_SERVICE_URL + " not returned data"); } List<org.smartregister.domain.jsonmapping.Location> receivedOpenMrsLocations = new Gson().fromJson(resp.payload(), new TypeToken<List<org.smartregister.domain.jsonmapping.Location>>() { }.getType()); for (org.smartregister.domain.jsonmapping.Location openMrsLocation : receivedOpenMrsLocations) { Location location = new Location(); location.setId(openMrsLocation.getLocationId()); LocationProperty property = new LocationProperty(); property.setUid(openMrsLocation.getLocationId()); property.setParentId(openMrsLocation.getParentLocation().getLocationId()); property.setName(openMrsLocation.getName()); location.setProperties(property); locationRepository.addOrUpdate(location); for (String tagName : openMrsLocation.getTags()) { LocationTag locationTag = new LocationTag(); locationTag.setLocationId(openMrsLocation.getLocationId()); locationTag.setName(tagName); locationTagRepository.addOrUpdate(locationTag); } } } | LocationServiceHelper extends BaseHelper { public void fetchLocationsByLevelAndTags() throws Exception { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(COMMON_LOCATIONS_SERVICE_URL + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); SyncConfiguration configs = getSyncConfiguration(); JSONObject requestPayload = new JSONObject(); requestPayload.put("locationUUID", allSharedPreferences.fetchDefaultLocalityId(allSharedPreferences.fetchRegisteredANM())); requestPayload.put("locationTopLevel", configs.getTopAllowedLocationLevel()); requestPayload.put("locationTagsQueried", new JSONArray(new Gson().toJson(configs.getSynchronizedLocationTags()))); Response<String> resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, COMMON_LOCATIONS_SERVICE_URL), requestPayload.toString()); if (resp.isFailure()) { throw new NoHttpResponseException(COMMON_LOCATIONS_SERVICE_URL + " not returned data"); } List<org.smartregister.domain.jsonmapping.Location> receivedOpenMrsLocations = new Gson().fromJson(resp.payload(), new TypeToken<List<org.smartregister.domain.jsonmapping.Location>>() { }.getType()); for (org.smartregister.domain.jsonmapping.Location openMrsLocation : receivedOpenMrsLocations) { Location location = new Location(); location.setId(openMrsLocation.getLocationId()); LocationProperty property = new LocationProperty(); property.setUid(openMrsLocation.getLocationId()); property.setParentId(openMrsLocation.getParentLocation().getLocationId()); property.setName(openMrsLocation.getName()); location.setProperties(property); locationRepository.addOrUpdate(location); for (String tagName : openMrsLocation.getTags()) { LocationTag locationTag = new LocationTag(); locationTag.setLocationId(openMrsLocation.getLocationId()); locationTag.setName(tagName); locationTagRepository.addOrUpdate(locationTag); } } } } | LocationServiceHelper extends BaseHelper { public void fetchLocationsByLevelAndTags() throws Exception { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(COMMON_LOCATIONS_SERVICE_URL + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); SyncConfiguration configs = getSyncConfiguration(); JSONObject requestPayload = new JSONObject(); requestPayload.put("locationUUID", allSharedPreferences.fetchDefaultLocalityId(allSharedPreferences.fetchRegisteredANM())); requestPayload.put("locationTopLevel", configs.getTopAllowedLocationLevel()); requestPayload.put("locationTagsQueried", new JSONArray(new Gson().toJson(configs.getSynchronizedLocationTags()))); Response<String> resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, COMMON_LOCATIONS_SERVICE_URL), requestPayload.toString()); if (resp.isFailure()) { throw new NoHttpResponseException(COMMON_LOCATIONS_SERVICE_URL + " not returned data"); } List<org.smartregister.domain.jsonmapping.Location> receivedOpenMrsLocations = new Gson().fromJson(resp.payload(), new TypeToken<List<org.smartregister.domain.jsonmapping.Location>>() { }.getType()); for (org.smartregister.domain.jsonmapping.Location openMrsLocation : receivedOpenMrsLocations) { Location location = new Location(); location.setId(openMrsLocation.getLocationId()); LocationProperty property = new LocationProperty(); property.setUid(openMrsLocation.getLocationId()); property.setParentId(openMrsLocation.getParentLocation().getLocationId()); property.setName(openMrsLocation.getName()); location.setProperties(property); locationRepository.addOrUpdate(location); for (String tagName : openMrsLocation.getTags()) { LocationTag locationTag = new LocationTag(); locationTag.setLocationId(openMrsLocation.getLocationId()); locationTag.setName(tagName); locationTagRepository.addOrUpdate(locationTag); } } } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); } | LocationServiceHelper extends BaseHelper { public void fetchLocationsByLevelAndTags() throws Exception { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(COMMON_LOCATIONS_SERVICE_URL + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); SyncConfiguration configs = getSyncConfiguration(); JSONObject requestPayload = new JSONObject(); requestPayload.put("locationUUID", allSharedPreferences.fetchDefaultLocalityId(allSharedPreferences.fetchRegisteredANM())); requestPayload.put("locationTopLevel", configs.getTopAllowedLocationLevel()); requestPayload.put("locationTagsQueried", new JSONArray(new Gson().toJson(configs.getSynchronizedLocationTags()))); Response<String> resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, COMMON_LOCATIONS_SERVICE_URL), requestPayload.toString()); if (resp.isFailure()) { throw new NoHttpResponseException(COMMON_LOCATIONS_SERVICE_URL + " not returned data"); } List<org.smartregister.domain.jsonmapping.Location> receivedOpenMrsLocations = new Gson().fromJson(resp.payload(), new TypeToken<List<org.smartregister.domain.jsonmapping.Location>>() { }.getType()); for (org.smartregister.domain.jsonmapping.Location openMrsLocation : receivedOpenMrsLocations) { Location location = new Location(); location.setId(openMrsLocation.getLocationId()); LocationProperty property = new LocationProperty(); property.setUid(openMrsLocation.getLocationId()); property.setParentId(openMrsLocation.getParentLocation().getLocationId()); property.setName(openMrsLocation.getName()); location.setProperties(property); locationRepository.addOrUpdate(location); for (String tagName : openMrsLocation.getTags()) { LocationTag locationTag = new LocationTag(); locationTag.setLocationId(openMrsLocation.getLocationId()); locationTag.setName(tagName); locationTagRepository.addOrUpdate(locationTag); } } } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); static LocationServiceHelper getInstance(); List<Location> fetchLocationsStructures(); void fetchLocationsByLevelAndTags(); SyncConfiguration getSyncConfiguration(); void syncCreatedStructureToServer(); void syncUpdatedLocationsToServer(); void fetchOpenMrsLocationsByTeamIds(); HTTPAgent getHttpAgent(); @NotNull String getFormattedBaseUrl(); void fetchAllLocations(); } | LocationServiceHelper extends BaseHelper { public void fetchLocationsByLevelAndTags() throws Exception { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(COMMON_LOCATIONS_SERVICE_URL + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); SyncConfiguration configs = getSyncConfiguration(); JSONObject requestPayload = new JSONObject(); requestPayload.put("locationUUID", allSharedPreferences.fetchDefaultLocalityId(allSharedPreferences.fetchRegisteredANM())); requestPayload.put("locationTopLevel", configs.getTopAllowedLocationLevel()); requestPayload.put("locationTagsQueried", new JSONArray(new Gson().toJson(configs.getSynchronizedLocationTags()))); Response<String> resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, COMMON_LOCATIONS_SERVICE_URL), requestPayload.toString()); if (resp.isFailure()) { throw new NoHttpResponseException(COMMON_LOCATIONS_SERVICE_URL + " not returned data"); } List<org.smartregister.domain.jsonmapping.Location> receivedOpenMrsLocations = new Gson().fromJson(resp.payload(), new TypeToken<List<org.smartregister.domain.jsonmapping.Location>>() { }.getType()); for (org.smartregister.domain.jsonmapping.Location openMrsLocation : receivedOpenMrsLocations) { Location location = new Location(); location.setId(openMrsLocation.getLocationId()); LocationProperty property = new LocationProperty(); property.setUid(openMrsLocation.getLocationId()); property.setParentId(openMrsLocation.getParentLocation().getLocationId()); property.setName(openMrsLocation.getName()); location.setProperties(property); locationRepository.addOrUpdate(location); for (String tagName : openMrsLocation.getTags()) { LocationTag locationTag = new LocationTag(); locationTag.setLocationId(openMrsLocation.getLocationId()); locationTag.setName(tagName); locationTagRepository.addOrUpdate(locationTag); } } } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); static LocationServiceHelper getInstance(); List<Location> fetchLocationsStructures(); void fetchLocationsByLevelAndTags(); SyncConfiguration getSyncConfiguration(); void syncCreatedStructureToServer(); void syncUpdatedLocationsToServer(); void fetchOpenMrsLocationsByTeamIds(); HTTPAgent getHttpAgent(); @NotNull String getFormattedBaseUrl(); void fetchAllLocations(); static final String LOCATION_STRUCTURE_URL; static final String CREATE_STRUCTURE_URL; static final String COMMON_LOCATIONS_SERVICE_URL; static final String OPENMRS_LOCATION_BY_TEAM_IDS; static final String STRUCTURES_LAST_SYNC_DATE; static final String LOCATION_LAST_SYNC_DATE; static Gson locationGson; } |
@Test public void testFetchLocationsStructures() { locationServiceHelper.fetchLocationsStructures(); verify(locationServiceHelper).syncLocationsStructures(true); verify(locationServiceHelper).syncLocationsStructures(false); verify(locationServiceHelper).syncCreatedStructureToServer(); verify(locationServiceHelper).syncCreatedStructureToServer(); } | public List<Location> fetchLocationsStructures() { syncLocationsStructures(true); List<Location> locations = syncLocationsStructures(false); syncCreatedStructureToServer(); syncUpdatedLocationsToServer(); return locations; } | LocationServiceHelper extends BaseHelper { public List<Location> fetchLocationsStructures() { syncLocationsStructures(true); List<Location> locations = syncLocationsStructures(false); syncCreatedStructureToServer(); syncUpdatedLocationsToServer(); return locations; } } | LocationServiceHelper extends BaseHelper { public List<Location> fetchLocationsStructures() { syncLocationsStructures(true); List<Location> locations = syncLocationsStructures(false); syncCreatedStructureToServer(); syncUpdatedLocationsToServer(); return locations; } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); } | LocationServiceHelper extends BaseHelper { public List<Location> fetchLocationsStructures() { syncLocationsStructures(true); List<Location> locations = syncLocationsStructures(false); syncCreatedStructureToServer(); syncUpdatedLocationsToServer(); return locations; } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); static LocationServiceHelper getInstance(); List<Location> fetchLocationsStructures(); void fetchLocationsByLevelAndTags(); SyncConfiguration getSyncConfiguration(); void syncCreatedStructureToServer(); void syncUpdatedLocationsToServer(); void fetchOpenMrsLocationsByTeamIds(); HTTPAgent getHttpAgent(); @NotNull String getFormattedBaseUrl(); void fetchAllLocations(); } | LocationServiceHelper extends BaseHelper { public List<Location> fetchLocationsStructures() { syncLocationsStructures(true); List<Location> locations = syncLocationsStructures(false); syncCreatedStructureToServer(); syncUpdatedLocationsToServer(); return locations; } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); static LocationServiceHelper getInstance(); List<Location> fetchLocationsStructures(); void fetchLocationsByLevelAndTags(); SyncConfiguration getSyncConfiguration(); void syncCreatedStructureToServer(); void syncUpdatedLocationsToServer(); void fetchOpenMrsLocationsByTeamIds(); HTTPAgent getHttpAgent(); @NotNull String getFormattedBaseUrl(); void fetchAllLocations(); static final String LOCATION_STRUCTURE_URL; static final String CREATE_STRUCTURE_URL; static final String COMMON_LOCATIONS_SERVICE_URL; static final String OPENMRS_LOCATION_BY_TEAM_IDS; static final String STRUCTURES_LAST_SYNC_DATE; static final String LOCATION_LAST_SYNC_DATE; static Gson locationGson; } |
@Test public void testSyncCreatedStructureToServer() { Location expectedStructure = LocationServiceHelper.locationGson.fromJson(structureJSon, new TypeToken<Location>() { }.getType()); expectedStructure.setSyncStatus(BaseRepository.TYPE_Unsynced); List<Location> structures = Collections.singletonList(expectedStructure); when(structureRepository.getAllUnsynchedCreatedStructures()).thenReturn(structures); Mockito.doReturn("https: Mockito.doReturn(new Response<>(ResponseStatus.success, LocationServiceHelper.locationGson.toJson(structures))) .when(httpAgent).postWithJsonResponse(stringArgumentCaptor.capture(), stringArgumentCaptor.capture()); locationServiceHelper.syncCreatedStructureToServer(); String syncUrl = stringArgumentCaptor.getAllValues().get(0); assertEquals("https: String requestString = stringArgumentCaptor.getAllValues().get(1); assertEquals(LocationServiceHelper.locationGson.toJson(structures), requestString); verify(structureRepository).markStructuresAsSynced(expectedStructure.getId()); } | public void syncCreatedStructureToServer() { List<Location> locations = structureRepository.getAllUnsynchedCreatedStructures(); if (!locations.isEmpty()) { String jsonPayload = locationGson.toJson(locations); String baseUrl = getFormattedBaseUrl(); Response<String> response = getHttpAgent().postWithJsonResponse( MessageFormat.format("{0}/{1}", baseUrl, CREATE_STRUCTURE_URL), jsonPayload); if (response.isFailure()) { Timber.e("Failed to create new locations on server: %s", response.payload()); return; } Set<String> unprocessedIds = new HashSet<>(); if (StringUtils.isNotBlank(response.payload())) { if (response.payload().startsWith(LOCATIONS_NOT_PROCESSED)) { unprocessedIds.addAll(Arrays.asList(response.payload().substring(LOCATIONS_NOT_PROCESSED.length()).split(","))); } for (Location location : locations) { if (!unprocessedIds.contains(location.getId())) structureRepository.markStructuresAsSynced(location.getId()); } } } } | LocationServiceHelper extends BaseHelper { public void syncCreatedStructureToServer() { List<Location> locations = structureRepository.getAllUnsynchedCreatedStructures(); if (!locations.isEmpty()) { String jsonPayload = locationGson.toJson(locations); String baseUrl = getFormattedBaseUrl(); Response<String> response = getHttpAgent().postWithJsonResponse( MessageFormat.format("{0}/{1}", baseUrl, CREATE_STRUCTURE_URL), jsonPayload); if (response.isFailure()) { Timber.e("Failed to create new locations on server: %s", response.payload()); return; } Set<String> unprocessedIds = new HashSet<>(); if (StringUtils.isNotBlank(response.payload())) { if (response.payload().startsWith(LOCATIONS_NOT_PROCESSED)) { unprocessedIds.addAll(Arrays.asList(response.payload().substring(LOCATIONS_NOT_PROCESSED.length()).split(","))); } for (Location location : locations) { if (!unprocessedIds.contains(location.getId())) structureRepository.markStructuresAsSynced(location.getId()); } } } } } | LocationServiceHelper extends BaseHelper { public void syncCreatedStructureToServer() { List<Location> locations = structureRepository.getAllUnsynchedCreatedStructures(); if (!locations.isEmpty()) { String jsonPayload = locationGson.toJson(locations); String baseUrl = getFormattedBaseUrl(); Response<String> response = getHttpAgent().postWithJsonResponse( MessageFormat.format("{0}/{1}", baseUrl, CREATE_STRUCTURE_URL), jsonPayload); if (response.isFailure()) { Timber.e("Failed to create new locations on server: %s", response.payload()); return; } Set<String> unprocessedIds = new HashSet<>(); if (StringUtils.isNotBlank(response.payload())) { if (response.payload().startsWith(LOCATIONS_NOT_PROCESSED)) { unprocessedIds.addAll(Arrays.asList(response.payload().substring(LOCATIONS_NOT_PROCESSED.length()).split(","))); } for (Location location : locations) { if (!unprocessedIds.contains(location.getId())) structureRepository.markStructuresAsSynced(location.getId()); } } } } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); } | LocationServiceHelper extends BaseHelper { public void syncCreatedStructureToServer() { List<Location> locations = structureRepository.getAllUnsynchedCreatedStructures(); if (!locations.isEmpty()) { String jsonPayload = locationGson.toJson(locations); String baseUrl = getFormattedBaseUrl(); Response<String> response = getHttpAgent().postWithJsonResponse( MessageFormat.format("{0}/{1}", baseUrl, CREATE_STRUCTURE_URL), jsonPayload); if (response.isFailure()) { Timber.e("Failed to create new locations on server: %s", response.payload()); return; } Set<String> unprocessedIds = new HashSet<>(); if (StringUtils.isNotBlank(response.payload())) { if (response.payload().startsWith(LOCATIONS_NOT_PROCESSED)) { unprocessedIds.addAll(Arrays.asList(response.payload().substring(LOCATIONS_NOT_PROCESSED.length()).split(","))); } for (Location location : locations) { if (!unprocessedIds.contains(location.getId())) structureRepository.markStructuresAsSynced(location.getId()); } } } } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); static LocationServiceHelper getInstance(); List<Location> fetchLocationsStructures(); void fetchLocationsByLevelAndTags(); SyncConfiguration getSyncConfiguration(); void syncCreatedStructureToServer(); void syncUpdatedLocationsToServer(); void fetchOpenMrsLocationsByTeamIds(); HTTPAgent getHttpAgent(); @NotNull String getFormattedBaseUrl(); void fetchAllLocations(); } | LocationServiceHelper extends BaseHelper { public void syncCreatedStructureToServer() { List<Location> locations = structureRepository.getAllUnsynchedCreatedStructures(); if (!locations.isEmpty()) { String jsonPayload = locationGson.toJson(locations); String baseUrl = getFormattedBaseUrl(); Response<String> response = getHttpAgent().postWithJsonResponse( MessageFormat.format("{0}/{1}", baseUrl, CREATE_STRUCTURE_URL), jsonPayload); if (response.isFailure()) { Timber.e("Failed to create new locations on server: %s", response.payload()); return; } Set<String> unprocessedIds = new HashSet<>(); if (StringUtils.isNotBlank(response.payload())) { if (response.payload().startsWith(LOCATIONS_NOT_PROCESSED)) { unprocessedIds.addAll(Arrays.asList(response.payload().substring(LOCATIONS_NOT_PROCESSED.length()).split(","))); } for (Location location : locations) { if (!unprocessedIds.contains(location.getId())) structureRepository.markStructuresAsSynced(location.getId()); } } } } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); static LocationServiceHelper getInstance(); List<Location> fetchLocationsStructures(); void fetchLocationsByLevelAndTags(); SyncConfiguration getSyncConfiguration(); void syncCreatedStructureToServer(); void syncUpdatedLocationsToServer(); void fetchOpenMrsLocationsByTeamIds(); HTTPAgent getHttpAgent(); @NotNull String getFormattedBaseUrl(); void fetchAllLocations(); static final String LOCATION_STRUCTURE_URL; static final String CREATE_STRUCTURE_URL; static final String COMMON_LOCATIONS_SERVICE_URL; static final String OPENMRS_LOCATION_BY_TEAM_IDS; static final String STRUCTURES_LAST_SYNC_DATE; static final String LOCATION_LAST_SYNC_DATE; static Gson locationGson; } |
@Test public void testSyncUpdatedLocationsToServer() { Location expectedLocation = LocationServiceHelper.locationGson.fromJson(locationJSon, new TypeToken<Location>() { }.getType()); expectedLocation.setSyncStatus(BaseRepository.TYPE_Unsynced); List<Location> locations = Collections.singletonList(expectedLocation); when(locationRepository.getAllUnsynchedLocation()).thenReturn(locations); Mockito.doReturn("https: Mockito.doReturn(new Response<>(ResponseStatus.success, LocationServiceHelper.locationGson.toJson(locations))) .when(httpAgent).postWithJsonResponse(stringArgumentCaptor.capture(), stringArgumentCaptor.capture()); locationServiceHelper.syncUpdatedLocationsToServer(); String syncUrl = stringArgumentCaptor.getAllValues().get(0); assertEquals("https: String requestString = stringArgumentCaptor.getAllValues().get(1); assertEquals(LocationServiceHelper.locationGson.toJson(locations), requestString); verify(locationRepository).markLocationsAsSynced(expectedLocation.getId()); } | public void syncUpdatedLocationsToServer() { HTTPAgent httpAgent = getHttpAgent(); List<Location> locations = locationRepository.getAllUnsynchedLocation(); if (!locations.isEmpty()) { String jsonPayload = locationGson.toJson(locations); String baseUrl = getFormattedBaseUrl(); String isJurisdictionParam = "?" + IS_JURISDICTION + "=true"; Response<String> response = httpAgent.postWithJsonResponse( MessageFormat.format("{0}{1}{2}", baseUrl, CREATE_STRUCTURE_URL, isJurisdictionParam), jsonPayload); if (response.isFailure()) { Timber.e("Failed to create new locations on server: %s", response.payload()); return; } Set<String> unprocessedIds = new HashSet<>(); if (StringUtils.isNotBlank(response.payload())) { if (response.payload().startsWith(LOCATIONS_NOT_PROCESSED)) { unprocessedIds.addAll(Arrays.asList(response.payload().substring(LOCATIONS_NOT_PROCESSED.length()).split(","))); } for (Location location : locations) { if (!unprocessedIds.contains(location.getId())) locationRepository.markLocationsAsSynced(location.getId()); } } } } | LocationServiceHelper extends BaseHelper { public void syncUpdatedLocationsToServer() { HTTPAgent httpAgent = getHttpAgent(); List<Location> locations = locationRepository.getAllUnsynchedLocation(); if (!locations.isEmpty()) { String jsonPayload = locationGson.toJson(locations); String baseUrl = getFormattedBaseUrl(); String isJurisdictionParam = "?" + IS_JURISDICTION + "=true"; Response<String> response = httpAgent.postWithJsonResponse( MessageFormat.format("{0}{1}{2}", baseUrl, CREATE_STRUCTURE_URL, isJurisdictionParam), jsonPayload); if (response.isFailure()) { Timber.e("Failed to create new locations on server: %s", response.payload()); return; } Set<String> unprocessedIds = new HashSet<>(); if (StringUtils.isNotBlank(response.payload())) { if (response.payload().startsWith(LOCATIONS_NOT_PROCESSED)) { unprocessedIds.addAll(Arrays.asList(response.payload().substring(LOCATIONS_NOT_PROCESSED.length()).split(","))); } for (Location location : locations) { if (!unprocessedIds.contains(location.getId())) locationRepository.markLocationsAsSynced(location.getId()); } } } } } | LocationServiceHelper extends BaseHelper { public void syncUpdatedLocationsToServer() { HTTPAgent httpAgent = getHttpAgent(); List<Location> locations = locationRepository.getAllUnsynchedLocation(); if (!locations.isEmpty()) { String jsonPayload = locationGson.toJson(locations); String baseUrl = getFormattedBaseUrl(); String isJurisdictionParam = "?" + IS_JURISDICTION + "=true"; Response<String> response = httpAgent.postWithJsonResponse( MessageFormat.format("{0}{1}{2}", baseUrl, CREATE_STRUCTURE_URL, isJurisdictionParam), jsonPayload); if (response.isFailure()) { Timber.e("Failed to create new locations on server: %s", response.payload()); return; } Set<String> unprocessedIds = new HashSet<>(); if (StringUtils.isNotBlank(response.payload())) { if (response.payload().startsWith(LOCATIONS_NOT_PROCESSED)) { unprocessedIds.addAll(Arrays.asList(response.payload().substring(LOCATIONS_NOT_PROCESSED.length()).split(","))); } for (Location location : locations) { if (!unprocessedIds.contains(location.getId())) locationRepository.markLocationsAsSynced(location.getId()); } } } } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); } | LocationServiceHelper extends BaseHelper { public void syncUpdatedLocationsToServer() { HTTPAgent httpAgent = getHttpAgent(); List<Location> locations = locationRepository.getAllUnsynchedLocation(); if (!locations.isEmpty()) { String jsonPayload = locationGson.toJson(locations); String baseUrl = getFormattedBaseUrl(); String isJurisdictionParam = "?" + IS_JURISDICTION + "=true"; Response<String> response = httpAgent.postWithJsonResponse( MessageFormat.format("{0}{1}{2}", baseUrl, CREATE_STRUCTURE_URL, isJurisdictionParam), jsonPayload); if (response.isFailure()) { Timber.e("Failed to create new locations on server: %s", response.payload()); return; } Set<String> unprocessedIds = new HashSet<>(); if (StringUtils.isNotBlank(response.payload())) { if (response.payload().startsWith(LOCATIONS_NOT_PROCESSED)) { unprocessedIds.addAll(Arrays.asList(response.payload().substring(LOCATIONS_NOT_PROCESSED.length()).split(","))); } for (Location location : locations) { if (!unprocessedIds.contains(location.getId())) locationRepository.markLocationsAsSynced(location.getId()); } } } } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); static LocationServiceHelper getInstance(); List<Location> fetchLocationsStructures(); void fetchLocationsByLevelAndTags(); SyncConfiguration getSyncConfiguration(); void syncCreatedStructureToServer(); void syncUpdatedLocationsToServer(); void fetchOpenMrsLocationsByTeamIds(); HTTPAgent getHttpAgent(); @NotNull String getFormattedBaseUrl(); void fetchAllLocations(); } | LocationServiceHelper extends BaseHelper { public void syncUpdatedLocationsToServer() { HTTPAgent httpAgent = getHttpAgent(); List<Location> locations = locationRepository.getAllUnsynchedLocation(); if (!locations.isEmpty()) { String jsonPayload = locationGson.toJson(locations); String baseUrl = getFormattedBaseUrl(); String isJurisdictionParam = "?" + IS_JURISDICTION + "=true"; Response<String> response = httpAgent.postWithJsonResponse( MessageFormat.format("{0}{1}{2}", baseUrl, CREATE_STRUCTURE_URL, isJurisdictionParam), jsonPayload); if (response.isFailure()) { Timber.e("Failed to create new locations on server: %s", response.payload()); return; } Set<String> unprocessedIds = new HashSet<>(); if (StringUtils.isNotBlank(response.payload())) { if (response.payload().startsWith(LOCATIONS_NOT_PROCESSED)) { unprocessedIds.addAll(Arrays.asList(response.payload().substring(LOCATIONS_NOT_PROCESSED.length()).split(","))); } for (Location location : locations) { if (!unprocessedIds.contains(location.getId())) locationRepository.markLocationsAsSynced(location.getId()); } } } } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); static LocationServiceHelper getInstance(); List<Location> fetchLocationsStructures(); void fetchLocationsByLevelAndTags(); SyncConfiguration getSyncConfiguration(); void syncCreatedStructureToServer(); void syncUpdatedLocationsToServer(); void fetchOpenMrsLocationsByTeamIds(); HTTPAgent getHttpAgent(); @NotNull String getFormattedBaseUrl(); void fetchAllLocations(); static final String LOCATION_STRUCTURE_URL; static final String CREATE_STRUCTURE_URL; static final String COMMON_LOCATIONS_SERVICE_URL; static final String OPENMRS_LOCATION_BY_TEAM_IDS; static final String STRUCTURES_LAST_SYNC_DATE; static final String LOCATION_LAST_SYNC_DATE; static Gson locationGson; } |
@Test public void testFetchAllLocations() { Mockito.doReturn(new Response<>(ResponseStatus.success, "[{\"type\":\"Feature\",\"id\":\"c2aa34c2-789b-467e-a0ab-9ea3d61632cf\",\"properties\":{\"status\":\"Active\",\"parentId\":\"\",\"name\":\"Level1\",\"geographicLevel\":1,\"version\":0},\"serverVersion\":0,\"locationTags\":[{\"id\":1,\"active\":true,\"name\":\"County\",\"description\":\"County Location Tag\"}]}," + "{\"type\":\"Feature\",\"id\":\"9dee11ba-d352-4df5-9efa-4607723b316e\",\"properties\":{\"status\":\"Active\",\"parentId\":\"c2aa34c2-789b-467e-a0ab-9ea3d61632cf\",\"name\":\"Level2\",\"geographicLevel\":2,\"version\":0},\"serverVersion\":0,\"locationTags\":[{\"id\":2,\"active\":true,\"name\":\"Subcounty\",\"description\":\"Subcounty Location Tag\"}]}]")) .when(httpAgent).post(stringArgumentCaptor.capture(), stringArgumentCaptor.capture()); locationServiceHelper.fetchAllLocations(); Mockito.verify(locationRepository, Mockito.atLeastOnce()).addOrUpdate(Mockito.any(Location.class)); String syncUrl = stringArgumentCaptor.getAllValues().get(0); assertEquals("https: String requestString = stringArgumentCaptor.getAllValues().get(1); assertEquals("{\"is_jurisdiction\":true,\"serverVersion\":0}", requestString); } | public void fetchAllLocations() { try { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(LOCATION_STRUCTURE_URL + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); JSONObject request = new JSONObject(); request.put(IS_JURISDICTION, true); request.put(AllConstants.SERVER_VERSION, 0); Response<String> resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, LOCATION_STRUCTURE_URL), request.toString()); if (resp.isFailure()) { throw new NoHttpResponseException(LOCATION_STRUCTURE_URL + " not returned data"); } List<Location> locations = locationGson.fromJson( resp.payload(), new TypeToken<List<Location>>() { }.getType() ); for (Location location : locations) { try { location.setSyncStatus(BaseRepository.TYPE_Synced); locationRepository.addOrUpdate(location); for (LocationTag tag : location.getLocationTags()) { LocationTag locationTag = new LocationTag(); locationTag.setLocationId(location.getId()); locationTag.setName(tag.getName()); locationTagRepository.addOrUpdate(locationTag); } } catch (Exception e) { Timber.e(e, "EXCEPTION %s", e.toString()); } } } catch (Exception e) { Timber.e(e, "EXCEPTION %s", e.toString()); } } | LocationServiceHelper extends BaseHelper { public void fetchAllLocations() { try { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(LOCATION_STRUCTURE_URL + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); JSONObject request = new JSONObject(); request.put(IS_JURISDICTION, true); request.put(AllConstants.SERVER_VERSION, 0); Response<String> resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, LOCATION_STRUCTURE_URL), request.toString()); if (resp.isFailure()) { throw new NoHttpResponseException(LOCATION_STRUCTURE_URL + " not returned data"); } List<Location> locations = locationGson.fromJson( resp.payload(), new TypeToken<List<Location>>() { }.getType() ); for (Location location : locations) { try { location.setSyncStatus(BaseRepository.TYPE_Synced); locationRepository.addOrUpdate(location); for (LocationTag tag : location.getLocationTags()) { LocationTag locationTag = new LocationTag(); locationTag.setLocationId(location.getId()); locationTag.setName(tag.getName()); locationTagRepository.addOrUpdate(locationTag); } } catch (Exception e) { Timber.e(e, "EXCEPTION %s", e.toString()); } } } catch (Exception e) { Timber.e(e, "EXCEPTION %s", e.toString()); } } } | LocationServiceHelper extends BaseHelper { public void fetchAllLocations() { try { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(LOCATION_STRUCTURE_URL + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); JSONObject request = new JSONObject(); request.put(IS_JURISDICTION, true); request.put(AllConstants.SERVER_VERSION, 0); Response<String> resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, LOCATION_STRUCTURE_URL), request.toString()); if (resp.isFailure()) { throw new NoHttpResponseException(LOCATION_STRUCTURE_URL + " not returned data"); } List<Location> locations = locationGson.fromJson( resp.payload(), new TypeToken<List<Location>>() { }.getType() ); for (Location location : locations) { try { location.setSyncStatus(BaseRepository.TYPE_Synced); locationRepository.addOrUpdate(location); for (LocationTag tag : location.getLocationTags()) { LocationTag locationTag = new LocationTag(); locationTag.setLocationId(location.getId()); locationTag.setName(tag.getName()); locationTagRepository.addOrUpdate(locationTag); } } catch (Exception e) { Timber.e(e, "EXCEPTION %s", e.toString()); } } } catch (Exception e) { Timber.e(e, "EXCEPTION %s", e.toString()); } } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); } | LocationServiceHelper extends BaseHelper { public void fetchAllLocations() { try { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(LOCATION_STRUCTURE_URL + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); JSONObject request = new JSONObject(); request.put(IS_JURISDICTION, true); request.put(AllConstants.SERVER_VERSION, 0); Response<String> resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, LOCATION_STRUCTURE_URL), request.toString()); if (resp.isFailure()) { throw new NoHttpResponseException(LOCATION_STRUCTURE_URL + " not returned data"); } List<Location> locations = locationGson.fromJson( resp.payload(), new TypeToken<List<Location>>() { }.getType() ); for (Location location : locations) { try { location.setSyncStatus(BaseRepository.TYPE_Synced); locationRepository.addOrUpdate(location); for (LocationTag tag : location.getLocationTags()) { LocationTag locationTag = new LocationTag(); locationTag.setLocationId(location.getId()); locationTag.setName(tag.getName()); locationTagRepository.addOrUpdate(locationTag); } } catch (Exception e) { Timber.e(e, "EXCEPTION %s", e.toString()); } } } catch (Exception e) { Timber.e(e, "EXCEPTION %s", e.toString()); } } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); static LocationServiceHelper getInstance(); List<Location> fetchLocationsStructures(); void fetchLocationsByLevelAndTags(); SyncConfiguration getSyncConfiguration(); void syncCreatedStructureToServer(); void syncUpdatedLocationsToServer(); void fetchOpenMrsLocationsByTeamIds(); HTTPAgent getHttpAgent(); @NotNull String getFormattedBaseUrl(); void fetchAllLocations(); } | LocationServiceHelper extends BaseHelper { public void fetchAllLocations() { try { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(LOCATION_STRUCTURE_URL + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); JSONObject request = new JSONObject(); request.put(IS_JURISDICTION, true); request.put(AllConstants.SERVER_VERSION, 0); Response<String> resp = httpAgent.post( MessageFormat.format("{0}{1}", baseUrl, LOCATION_STRUCTURE_URL), request.toString()); if (resp.isFailure()) { throw new NoHttpResponseException(LOCATION_STRUCTURE_URL + " not returned data"); } List<Location> locations = locationGson.fromJson( resp.payload(), new TypeToken<List<Location>>() { }.getType() ); for (Location location : locations) { try { location.setSyncStatus(BaseRepository.TYPE_Synced); locationRepository.addOrUpdate(location); for (LocationTag tag : location.getLocationTags()) { LocationTag locationTag = new LocationTag(); locationTag.setLocationId(location.getId()); locationTag.setName(tag.getName()); locationTagRepository.addOrUpdate(locationTag); } } catch (Exception e) { Timber.e(e, "EXCEPTION %s", e.toString()); } } } catch (Exception e) { Timber.e(e, "EXCEPTION %s", e.toString()); } } LocationServiceHelper(LocationRepository locationRepository, LocationTagRepository locationTagRepository, StructureRepository structureRepository); static LocationServiceHelper getInstance(); List<Location> fetchLocationsStructures(); void fetchLocationsByLevelAndTags(); SyncConfiguration getSyncConfiguration(); void syncCreatedStructureToServer(); void syncUpdatedLocationsToServer(); void fetchOpenMrsLocationsByTeamIds(); HTTPAgent getHttpAgent(); @NotNull String getFormattedBaseUrl(); void fetchAllLocations(); static final String LOCATION_STRUCTURE_URL; static final String CREATE_STRUCTURE_URL; static final String COMMON_LOCATIONS_SERVICE_URL; static final String OPENMRS_LOCATION_BY_TEAM_IDS; static final String STRUCTURES_LAST_SYNC_DATE; static final String LOCATION_LAST_SYNC_DATE; static Gson locationGson; } |
@Test public void authorizeConnectionShouldCallOnConnectionAuthorizedWhenPeerDeviceTeamIdIsEqualsCurrentDeviceTeamId() { P2PAuthorizationService.AuthorizationCallback authorizationCallback = Mockito.mock(P2PAuthorizationService.AuthorizationCallback.class); HashMap<String, Object> peerDeviceMap = new HashMap<>(); peerDeviceMap.put(AllConstants.PeerToPeer.KEY_TEAM_ID, "90392-232532-dsfsdf"); p2PSyncAuthorizationService.authorizeConnection(peerDeviceMap, authorizationCallback); Mockito.verify(authorizationCallback, Mockito.times(1)).onConnectionAuthorized(); } | @Override public void authorizeConnection(@NonNull final Map<String, Object> peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback) { getAuthorizationDetails(new OnAuthorizationDetailsProvidedCallback() { @Override public void onAuthorizationDetailsProvided(@NonNull Map<String, Object> map) { Object peerDeviceTeamId = peerDeviceMap.get(AllConstants.PeerToPeer.KEY_TEAM_ID); if (peerDeviceTeamId != null && peerDeviceTeamId instanceof String && ((String) peerDeviceTeamId).equals(map.get(AllConstants.PeerToPeer.KEY_TEAM_ID))) { authorizationCallback.onConnectionAuthorized(); } else { authorizationCallback.onConnectionAuthorizationRejected("Incorrect authorization details provided"); } } }); } | P2PSyncAuthorizationService implements P2PAuthorizationService { @Override public void authorizeConnection(@NonNull final Map<String, Object> peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback) { getAuthorizationDetails(new OnAuthorizationDetailsProvidedCallback() { @Override public void onAuthorizationDetailsProvided(@NonNull Map<String, Object> map) { Object peerDeviceTeamId = peerDeviceMap.get(AllConstants.PeerToPeer.KEY_TEAM_ID); if (peerDeviceTeamId != null && peerDeviceTeamId instanceof String && ((String) peerDeviceTeamId).equals(map.get(AllConstants.PeerToPeer.KEY_TEAM_ID))) { authorizationCallback.onConnectionAuthorized(); } else { authorizationCallback.onConnectionAuthorizationRejected("Incorrect authorization details provided"); } } }); } } | P2PSyncAuthorizationService implements P2PAuthorizationService { @Override public void authorizeConnection(@NonNull final Map<String, Object> peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback) { getAuthorizationDetails(new OnAuthorizationDetailsProvidedCallback() { @Override public void onAuthorizationDetailsProvided(@NonNull Map<String, Object> map) { Object peerDeviceTeamId = peerDeviceMap.get(AllConstants.PeerToPeer.KEY_TEAM_ID); if (peerDeviceTeamId != null && peerDeviceTeamId instanceof String && ((String) peerDeviceTeamId).equals(map.get(AllConstants.PeerToPeer.KEY_TEAM_ID))) { authorizationCallback.onConnectionAuthorized(); } else { authorizationCallback.onConnectionAuthorizationRejected("Incorrect authorization details provided"); } } }); } P2PSyncAuthorizationService(@NonNull String teamId); } | P2PSyncAuthorizationService implements P2PAuthorizationService { @Override public void authorizeConnection(@NonNull final Map<String, Object> peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback) { getAuthorizationDetails(new OnAuthorizationDetailsProvidedCallback() { @Override public void onAuthorizationDetailsProvided(@NonNull Map<String, Object> map) { Object peerDeviceTeamId = peerDeviceMap.get(AllConstants.PeerToPeer.KEY_TEAM_ID); if (peerDeviceTeamId != null && peerDeviceTeamId instanceof String && ((String) peerDeviceTeamId).equals(map.get(AllConstants.PeerToPeer.KEY_TEAM_ID))) { authorizationCallback.onConnectionAuthorized(); } else { authorizationCallback.onConnectionAuthorizationRejected("Incorrect authorization details provided"); } } }); } P2PSyncAuthorizationService(@NonNull String teamId); @Override void authorizeConnection(@NonNull final Map<String, Object> peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback); @Override void getAuthorizationDetails(@NonNull OnAuthorizationDetailsProvidedCallback onAuthorizationDetailsProvidedCallback); } | P2PSyncAuthorizationService implements P2PAuthorizationService { @Override public void authorizeConnection(@NonNull final Map<String, Object> peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback) { getAuthorizationDetails(new OnAuthorizationDetailsProvidedCallback() { @Override public void onAuthorizationDetailsProvided(@NonNull Map<String, Object> map) { Object peerDeviceTeamId = peerDeviceMap.get(AllConstants.PeerToPeer.KEY_TEAM_ID); if (peerDeviceTeamId != null && peerDeviceTeamId instanceof String && ((String) peerDeviceTeamId).equals(map.get(AllConstants.PeerToPeer.KEY_TEAM_ID))) { authorizationCallback.onConnectionAuthorized(); } else { authorizationCallback.onConnectionAuthorizationRejected("Incorrect authorization details provided"); } } }); } P2PSyncAuthorizationService(@NonNull String teamId); @Override void authorizeConnection(@NonNull final Map<String, Object> peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback); @Override void getAuthorizationDetails(@NonNull OnAuthorizationDetailsProvidedCallback onAuthorizationDetailsProvidedCallback); } |
@Test public void authorizeConnectionShouldCallOnConnectionAuthorizationRejectedWhenPeerDeviceTeamIdsAreNotEqual() { P2PAuthorizationService.AuthorizationCallback authorizationCallback = Mockito.mock(P2PAuthorizationService.AuthorizationCallback.class); HashMap<String, Object> peerDeviceMap = new HashMap<>(); peerDeviceMap.put(AllConstants.PeerToPeer.KEY_TEAM_ID, "different-team_id"); p2PSyncAuthorizationService.authorizeConnection(peerDeviceMap, authorizationCallback); Mockito.verify(authorizationCallback, Mockito.times(1)).onConnectionAuthorizationRejected(ArgumentMatchers.eq("Incorrect authorization details provided")); } | @Override public void authorizeConnection(@NonNull final Map<String, Object> peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback) { getAuthorizationDetails(new OnAuthorizationDetailsProvidedCallback() { @Override public void onAuthorizationDetailsProvided(@NonNull Map<String, Object> map) { Object peerDeviceTeamId = peerDeviceMap.get(AllConstants.PeerToPeer.KEY_TEAM_ID); if (peerDeviceTeamId != null && peerDeviceTeamId instanceof String && ((String) peerDeviceTeamId).equals(map.get(AllConstants.PeerToPeer.KEY_TEAM_ID))) { authorizationCallback.onConnectionAuthorized(); } else { authorizationCallback.onConnectionAuthorizationRejected("Incorrect authorization details provided"); } } }); } | P2PSyncAuthorizationService implements P2PAuthorizationService { @Override public void authorizeConnection(@NonNull final Map<String, Object> peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback) { getAuthorizationDetails(new OnAuthorizationDetailsProvidedCallback() { @Override public void onAuthorizationDetailsProvided(@NonNull Map<String, Object> map) { Object peerDeviceTeamId = peerDeviceMap.get(AllConstants.PeerToPeer.KEY_TEAM_ID); if (peerDeviceTeamId != null && peerDeviceTeamId instanceof String && ((String) peerDeviceTeamId).equals(map.get(AllConstants.PeerToPeer.KEY_TEAM_ID))) { authorizationCallback.onConnectionAuthorized(); } else { authorizationCallback.onConnectionAuthorizationRejected("Incorrect authorization details provided"); } } }); } } | P2PSyncAuthorizationService implements P2PAuthorizationService { @Override public void authorizeConnection(@NonNull final Map<String, Object> peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback) { getAuthorizationDetails(new OnAuthorizationDetailsProvidedCallback() { @Override public void onAuthorizationDetailsProvided(@NonNull Map<String, Object> map) { Object peerDeviceTeamId = peerDeviceMap.get(AllConstants.PeerToPeer.KEY_TEAM_ID); if (peerDeviceTeamId != null && peerDeviceTeamId instanceof String && ((String) peerDeviceTeamId).equals(map.get(AllConstants.PeerToPeer.KEY_TEAM_ID))) { authorizationCallback.onConnectionAuthorized(); } else { authorizationCallback.onConnectionAuthorizationRejected("Incorrect authorization details provided"); } } }); } P2PSyncAuthorizationService(@NonNull String teamId); } | P2PSyncAuthorizationService implements P2PAuthorizationService { @Override public void authorizeConnection(@NonNull final Map<String, Object> peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback) { getAuthorizationDetails(new OnAuthorizationDetailsProvidedCallback() { @Override public void onAuthorizationDetailsProvided(@NonNull Map<String, Object> map) { Object peerDeviceTeamId = peerDeviceMap.get(AllConstants.PeerToPeer.KEY_TEAM_ID); if (peerDeviceTeamId != null && peerDeviceTeamId instanceof String && ((String) peerDeviceTeamId).equals(map.get(AllConstants.PeerToPeer.KEY_TEAM_ID))) { authorizationCallback.onConnectionAuthorized(); } else { authorizationCallback.onConnectionAuthorizationRejected("Incorrect authorization details provided"); } } }); } P2PSyncAuthorizationService(@NonNull String teamId); @Override void authorizeConnection(@NonNull final Map<String, Object> peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback); @Override void getAuthorizationDetails(@NonNull OnAuthorizationDetailsProvidedCallback onAuthorizationDetailsProvidedCallback); } | P2PSyncAuthorizationService implements P2PAuthorizationService { @Override public void authorizeConnection(@NonNull final Map<String, Object> peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback) { getAuthorizationDetails(new OnAuthorizationDetailsProvidedCallback() { @Override public void onAuthorizationDetailsProvided(@NonNull Map<String, Object> map) { Object peerDeviceTeamId = peerDeviceMap.get(AllConstants.PeerToPeer.KEY_TEAM_ID); if (peerDeviceTeamId != null && peerDeviceTeamId instanceof String && ((String) peerDeviceTeamId).equals(map.get(AllConstants.PeerToPeer.KEY_TEAM_ID))) { authorizationCallback.onConnectionAuthorized(); } else { authorizationCallback.onConnectionAuthorizationRejected("Incorrect authorization details provided"); } } }); } P2PSyncAuthorizationService(@NonNull String teamId); @Override void authorizeConnection(@NonNull final Map<String, Object> peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback); @Override void getAuthorizationDetails(@NonNull OnAuthorizationDetailsProvidedCallback onAuthorizationDetailsProvidedCallback); } |
@Test public void assertReturnsCorrectFileExtension() { Assert.assertEquals(FileUtilities.getFileExtension(FILE_NAME), "txt"); } | public static String getFileExtension(String fileName) { String extension = ""; if (fileName != null && !fileName.isEmpty()) { int i = fileName.lastIndexOf('.'); if (i > 0) { extension = fileName.substring(i + 1); } } return extension; } | FileUtilities { public static String getFileExtension(String fileName) { String extension = ""; if (fileName != null && !fileName.isEmpty()) { int i = fileName.lastIndexOf('.'); if (i > 0) { extension = fileName.substring(i + 1); } } return extension; } } | FileUtilities { public static String getFileExtension(String fileName) { String extension = ""; if (fileName != null && !fileName.isEmpty()) { int i = fileName.lastIndexOf('.'); if (i > 0) { extension = fileName.substring(i + 1); } } return extension; } FileUtilities(); } | FileUtilities { public static String getFileExtension(String fileName) { String extension = ""; if (fileName != null && !fileName.isEmpty()) { int i = fileName.lastIndexOf('.'); if (i > 0) { extension = fileName.substring(i + 1); } } return extension; } FileUtilities(); static Bitmap retrieveStaticImageFromDisk(String fileName); static String getFileExtension(String fileName); static String getUserAgent(Context mContext); static String getImageUrl(String entityID); void write(String fileName, String data); Writer getWriter(); String getAbsolutePath(); } | FileUtilities { public static String getFileExtension(String fileName) { String extension = ""; if (fileName != null && !fileName.isEmpty()) { int i = fileName.lastIndexOf('.'); if (i > 0) { extension = fileName.substring(i + 1); } } return extension; } FileUtilities(); static Bitmap retrieveStaticImageFromDisk(String fileName); static String getFileExtension(String fileName); static String getUserAgent(Context mContext); static String getImageUrl(String entityID); void write(String fileName, String data); Writer getWriter(); String getAbsolutePath(); } |
@Test public void onReceiveShouldLogoutUserWhenActionTimeChanged() { Intent intent = new Intent(Intent.ACTION_TIME_CHANGED); openSRPClientBroadCastReceiver.onReceive(RuntimeEnvironment.application, intent); Mockito.verify(drishtiApplication).logoutCurrentUser(); } | @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } | OpenSRPClientBroadCastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } } | OpenSRPClientBroadCastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } OpenSRPClientBroadCastReceiver(Activity _activity); } | OpenSRPClientBroadCastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } OpenSRPClientBroadCastReceiver(Activity _activity); @Override void onReceive(Context context, Intent intent); } | OpenSRPClientBroadCastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } OpenSRPClientBroadCastReceiver(Activity _activity); @Override void onReceive(Context context, Intent intent); } |
@Test public void onReceiveShouldLogoutUserWhenActionTimeZoneChanged() { Intent intent = new Intent(Intent.ACTION_TIMEZONE_CHANGED); openSRPClientBroadCastReceiver.onReceive(RuntimeEnvironment.application, intent); Mockito.verify(drishtiApplication).logoutCurrentUser(); } | @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } | OpenSRPClientBroadCastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } } | OpenSRPClientBroadCastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } OpenSRPClientBroadCastReceiver(Activity _activity); } | OpenSRPClientBroadCastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } OpenSRPClientBroadCastReceiver(Activity _activity); @Override void onReceive(Context context, Intent intent); } | OpenSRPClientBroadCastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } OpenSRPClientBroadCastReceiver(Activity _activity); @Override void onReceive(Context context, Intent intent); } |
@Test public void onReceiveShouldDoNothingWhenCloudantSyncDatabaseCreated() { Intent intent = new Intent(AllConstants.CloudantSync.ACTION_DATABASE_CREATED); openSRPClientBroadCastReceiver.onReceive(RuntimeEnvironment.application, intent); Mockito.verifyZeroInteractions(drishtiApplication); } | @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } | OpenSRPClientBroadCastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } } | OpenSRPClientBroadCastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } OpenSRPClientBroadCastReceiver(Activity _activity); } | OpenSRPClientBroadCastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } OpenSRPClientBroadCastReceiver(Activity _activity); @Override void onReceive(Context context, Intent intent); } | OpenSRPClientBroadCastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } OpenSRPClientBroadCastReceiver(Activity _activity); @Override void onReceive(Context context, Intent intent); } |
@Test public void onReceiveShouldDoNothingWhenCloudantSyncReplicationCompleted() { Intent intent = new Intent(AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED); openSRPClientBroadCastReceiver.onReceive(RuntimeEnvironment.application, intent); Mockito.verifyZeroInteractions(drishtiApplication); } | @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } | OpenSRPClientBroadCastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } } | OpenSRPClientBroadCastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } OpenSRPClientBroadCastReceiver(Activity _activity); } | OpenSRPClientBroadCastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } OpenSRPClientBroadCastReceiver(Activity _activity); @Override void onReceive(Context context, Intent intent); } | OpenSRPClientBroadCastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } OpenSRPClientBroadCastReceiver(Activity _activity); @Override void onReceive(Context context, Intent intent); } |
@Test public void onReceiveShouldShowToastWhenCloudantSyncReplicationError() { Intent intent = new Intent(AllConstants.CloudantSync.ACTION_REPLICATION_ERROR); openSRPClientBroadCastReceiver.onReceive(RuntimeEnvironment.application, intent); Mockito.verifyZeroInteractions(drishtiApplication); Mockito.verify(activity).showToast(Mockito.eq("Replication error occurred")); } | @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } | OpenSRPClientBroadCastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } } | OpenSRPClientBroadCastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } OpenSRPClientBroadCastReceiver(Activity _activity); } | OpenSRPClientBroadCastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } OpenSRPClientBroadCastReceiver(Activity _activity); @Override void onReceive(Context context, Intent intent); } | OpenSRPClientBroadCastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED: Timber.d("timezonechanged"); forceFullySignOut(); break; case AllConstants.CloudantSync.ACTION_DATABASE_CREATED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_COMPLETED: break; case AllConstants.CloudantSync.ACTION_REPLICATION_ERROR: ((SecuredActivity) activity).showToast(context.getString(R.string.replication_error_occurred)); break; default: } } catch (Exception e) { Timber.e(e); } } OpenSRPClientBroadCastReceiver(Activity _activity); @Override void onReceive(Context context, Intent intent); } |
@Test public void testCompressMethodReturnsACompressedOutput() throws IOException { byte[] original = TEST_STRING.getBytes(CharEncoding.UTF_8); byte[] compressed = gzipCompression.compress(TEST_STRING); Assert.assertTrue(original.length > compressed.length); } | @Override public byte[] compress(String rawString) { try { ByteArrayOutputStream os = new ByteArrayOutputStream(); GZIPOutputStream gos = new GZIPOutputStream(os); gos.write(rawString.getBytes(CharEncoding.UTF_8)); gos.close(); byte[] compressed = os.toByteArray(); os.close(); return compressed; } catch (IOException e) { Timber.e(e); return null; } } | GZIPCompression implements ICompression { @Override public byte[] compress(String rawString) { try { ByteArrayOutputStream os = new ByteArrayOutputStream(); GZIPOutputStream gos = new GZIPOutputStream(os); gos.write(rawString.getBytes(CharEncoding.UTF_8)); gos.close(); byte[] compressed = os.toByteArray(); os.close(); return compressed; } catch (IOException e) { Timber.e(e); return null; } } } | GZIPCompression implements ICompression { @Override public byte[] compress(String rawString) { try { ByteArrayOutputStream os = new ByteArrayOutputStream(); GZIPOutputStream gos = new GZIPOutputStream(os); gos.write(rawString.getBytes(CharEncoding.UTF_8)); gos.close(); byte[] compressed = os.toByteArray(); os.close(); return compressed; } catch (IOException e) { Timber.e(e); return null; } } } | GZIPCompression implements ICompression { @Override public byte[] compress(String rawString) { try { ByteArrayOutputStream os = new ByteArrayOutputStream(); GZIPOutputStream gos = new GZIPOutputStream(os); gos.write(rawString.getBytes(CharEncoding.UTF_8)); gos.close(); byte[] compressed = os.toByteArray(); os.close(); return compressed; } catch (IOException e) { Timber.e(e); return null; } } @Override byte[] compress(String rawString); @Override String decompress(byte[] compressedBytes); @Override void compress(String inputFilePath, String compressedOutputFilepath); @Override void decompress(String compressedInputFilePath, String decompressedOutputFilePath); } | GZIPCompression implements ICompression { @Override public byte[] compress(String rawString) { try { ByteArrayOutputStream os = new ByteArrayOutputStream(); GZIPOutputStream gos = new GZIPOutputStream(os); gos.write(rawString.getBytes(CharEncoding.UTF_8)); gos.close(); byte[] compressed = os.toByteArray(); os.close(); return compressed; } catch (IOException e) { Timber.e(e); return null; } } @Override byte[] compress(String rawString); @Override String decompress(byte[] compressedBytes); @Override void compress(String inputFilePath, String compressedOutputFilepath); @Override void decompress(String compressedInputFilePath, String decompressedOutputFilePath); } |
@Test public void testCompressFileMethodReturnsACompressedOutputFile() throws IOException { String filePath = getFilePath("compression_test_file.txt"); String outputFilePath = filePath + "_compressed.gz"; File originalFile = new File(filePath); Assert.assertTrue(originalFile.length() > 0); File compressedFile = new File(outputFilePath); Assert.assertEquals(0, compressedFile.length()); gzipCompression.compress(filePath, outputFilePath); Assert.assertTrue(compressedFile.length() > 0); Assert.assertTrue(compressedFile.length() < originalFile.length()); } | @Override public byte[] compress(String rawString) { try { ByteArrayOutputStream os = new ByteArrayOutputStream(); GZIPOutputStream gos = new GZIPOutputStream(os); gos.write(rawString.getBytes(CharEncoding.UTF_8)); gos.close(); byte[] compressed = os.toByteArray(); os.close(); return compressed; } catch (IOException e) { Timber.e(e); return null; } } | GZIPCompression implements ICompression { @Override public byte[] compress(String rawString) { try { ByteArrayOutputStream os = new ByteArrayOutputStream(); GZIPOutputStream gos = new GZIPOutputStream(os); gos.write(rawString.getBytes(CharEncoding.UTF_8)); gos.close(); byte[] compressed = os.toByteArray(); os.close(); return compressed; } catch (IOException e) { Timber.e(e); return null; } } } | GZIPCompression implements ICompression { @Override public byte[] compress(String rawString) { try { ByteArrayOutputStream os = new ByteArrayOutputStream(); GZIPOutputStream gos = new GZIPOutputStream(os); gos.write(rawString.getBytes(CharEncoding.UTF_8)); gos.close(); byte[] compressed = os.toByteArray(); os.close(); return compressed; } catch (IOException e) { Timber.e(e); return null; } } } | GZIPCompression implements ICompression { @Override public byte[] compress(String rawString) { try { ByteArrayOutputStream os = new ByteArrayOutputStream(); GZIPOutputStream gos = new GZIPOutputStream(os); gos.write(rawString.getBytes(CharEncoding.UTF_8)); gos.close(); byte[] compressed = os.toByteArray(); os.close(); return compressed; } catch (IOException e) { Timber.e(e); return null; } } @Override byte[] compress(String rawString); @Override String decompress(byte[] compressedBytes); @Override void compress(String inputFilePath, String compressedOutputFilepath); @Override void decompress(String compressedInputFilePath, String decompressedOutputFilePath); } | GZIPCompression implements ICompression { @Override public byte[] compress(String rawString) { try { ByteArrayOutputStream os = new ByteArrayOutputStream(); GZIPOutputStream gos = new GZIPOutputStream(os); gos.write(rawString.getBytes(CharEncoding.UTF_8)); gos.close(); byte[] compressed = os.toByteArray(); os.close(); return compressed; } catch (IOException e) { Timber.e(e); return null; } } @Override byte[] compress(String rawString); @Override String decompress(byte[] compressedBytes); @Override void compress(String inputFilePath, String compressedOutputFilepath); @Override void decompress(String compressedInputFilePath, String decompressedOutputFilePath); } |
@Test public void assertConvertDateFormatTestReturnsDate() throws Exception { assertEquals("20-10-2017", Utils.convertDateFormat("2017-10-20", true)); assertEquals("", Utils.convertDateFormat("20171020", true)); } | public static String convertDateFormat(String date, boolean suppressException) { try { return UI_DF.format(DB_DF.parse(date)); } catch (ParseException e) { if (!suppressException) throw new RuntimeException(e); } return ""; } | Utils { public static String convertDateFormat(String date, boolean suppressException) { try { return UI_DF.format(DB_DF.parse(date)); } catch (ParseException e) { if (!suppressException) throw new RuntimeException(e); } return ""; } } | Utils { public static String convertDateFormat(String date, boolean suppressException) { try { return UI_DF.format(DB_DF.parse(date)); } catch (ParseException e) { if (!suppressException) throw new RuntimeException(e); } return ""; } } | Utils { public static String convertDateFormat(String date, boolean suppressException) { try { return UI_DF.format(DB_DF.parse(date)); } catch (ParseException e) { if (!suppressException) throw new RuntimeException(e); } return ""; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static String convertDateFormat(String date, boolean suppressException) { try { return UI_DF.format(DB_DF.parse(date)); } catch (ParseException e) { if (!suppressException) throw new RuntimeException(e); } return ""; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void testGetScreenDpiReturnsCorrectValuesForHighDensity() { Mockito.doReturn(resources).when(context).getResources(); DisplayMetrics displayMetrics = new DisplayMetrics(); displayMetrics.density = 1.1f; Mockito.doReturn(displayMetrics).when(resources).getDisplayMetrics(); DisplayUtils.ScreenDpi screenDpi = DisplayUtils.getScreenDpi(context); Assert.assertEquals(DisplayUtils.ScreenDpi.HDPI, screenDpi); displayMetrics = new DisplayMetrics(); displayMetrics.density = 1.5f; Mockito.doReturn(displayMetrics).when(resources).getDisplayMetrics(); screenDpi = DisplayUtils.getScreenDpi(context); Assert.assertEquals(DisplayUtils.ScreenDpi.HDPI, screenDpi); } | public static ScreenDpi getScreenDpi(Context context) { float density = context.getResources().getDisplayMetrics().density; ScreenDpi dpi = ScreenDpi.XXXHDPI; if (density <= 0.75) { dpi = ScreenDpi.LDPI; } else if (density > 0.75 && density <= 1.0) { dpi = ScreenDpi.MDPI; } else if (density > 1.0 && density <= 1.5) { dpi = ScreenDpi.HDPI; } else if (density > 1.5 && density <= 2.0) { dpi = ScreenDpi.XHDPI; } else if (density > 2.0 && density <= 3.0) { dpi = ScreenDpi.XXHDPI; } return dpi; } | DisplayUtils { public static ScreenDpi getScreenDpi(Context context) { float density = context.getResources().getDisplayMetrics().density; ScreenDpi dpi = ScreenDpi.XXXHDPI; if (density <= 0.75) { dpi = ScreenDpi.LDPI; } else if (density > 0.75 && density <= 1.0) { dpi = ScreenDpi.MDPI; } else if (density > 1.0 && density <= 1.5) { dpi = ScreenDpi.HDPI; } else if (density > 1.5 && density <= 2.0) { dpi = ScreenDpi.XHDPI; } else if (density > 2.0 && density <= 3.0) { dpi = ScreenDpi.XXHDPI; } return dpi; } } | DisplayUtils { public static ScreenDpi getScreenDpi(Context context) { float density = context.getResources().getDisplayMetrics().density; ScreenDpi dpi = ScreenDpi.XXXHDPI; if (density <= 0.75) { dpi = ScreenDpi.LDPI; } else if (density > 0.75 && density <= 1.0) { dpi = ScreenDpi.MDPI; } else if (density > 1.0 && density <= 1.5) { dpi = ScreenDpi.HDPI; } else if (density > 1.5 && density <= 2.0) { dpi = ScreenDpi.XHDPI; } else if (density > 2.0 && density <= 3.0) { dpi = ScreenDpi.XXHDPI; } return dpi; } } | DisplayUtils { public static ScreenDpi getScreenDpi(Context context) { float density = context.getResources().getDisplayMetrics().density; ScreenDpi dpi = ScreenDpi.XXXHDPI; if (density <= 0.75) { dpi = ScreenDpi.LDPI; } else if (density > 0.75 && density <= 1.0) { dpi = ScreenDpi.MDPI; } else if (density > 1.0 && density <= 1.5) { dpi = ScreenDpi.HDPI; } else if (density > 1.5 && density <= 2.0) { dpi = ScreenDpi.XHDPI; } else if (density > 2.0 && density <= 3.0) { dpi = ScreenDpi.XXHDPI; } return dpi; } static ScreenDpi getScreenDpi(Context context); static int getDisplayWidth(Activity activity); static int getDisplayHeight(Activity activity); static double getScreenSize(Activity activity); } | DisplayUtils { public static ScreenDpi getScreenDpi(Context context) { float density = context.getResources().getDisplayMetrics().density; ScreenDpi dpi = ScreenDpi.XXXHDPI; if (density <= 0.75) { dpi = ScreenDpi.LDPI; } else if (density > 0.75 && density <= 1.0) { dpi = ScreenDpi.MDPI; } else if (density > 1.0 && density <= 1.5) { dpi = ScreenDpi.HDPI; } else if (density > 1.5 && density <= 2.0) { dpi = ScreenDpi.XHDPI; } else if (density > 2.0 && density <= 3.0) { dpi = ScreenDpi.XXHDPI; } return dpi; } static ScreenDpi getScreenDpi(Context context); static int getDisplayWidth(Activity activity); static int getDisplayHeight(Activity activity); static double getScreenSize(Activity activity); } |
@Test public void assertToDateReturnsDate() throws Exception { SimpleDateFormat DB_DF = new SimpleDateFormat("yyyy-MM-dd"); Date date = DB_DF.parse("2017-10-20"); org.junit.Assert.assertNotNull(Utils.toDate("2017-10-20", true)); assertNull(Utils.toDate("20171020", true)); assertEquals(date, Utils.toDate("2017-10-20", true)); } | public static Date toDate(String date, boolean suppressException) { try { return DB_DF.parse(date); } catch (ParseException e) { if (!suppressException) throw new RuntimeException(e); } return null; } | Utils { public static Date toDate(String date, boolean suppressException) { try { return DB_DF.parse(date); } catch (ParseException e) { if (!suppressException) throw new RuntimeException(e); } return null; } } | Utils { public static Date toDate(String date, boolean suppressException) { try { return DB_DF.parse(date); } catch (ParseException e) { if (!suppressException) throw new RuntimeException(e); } return null; } } | Utils { public static Date toDate(String date, boolean suppressException) { try { return DB_DF.parse(date); } catch (ParseException e) { if (!suppressException) throw new RuntimeException(e); } return null; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static Date toDate(String date, boolean suppressException) { try { return DB_DF.parse(date); } catch (ParseException e) { if (!suppressException) throw new RuntimeException(e); } return null; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void assertConvertDateFormat() throws Exception { assertEquals("20-10-2017", Utils.convertDateFormat("2017-10-20", "abcdxyz", true)); assertEquals("abcdxyz", Utils.convertDateFormat("20171020", "abcdxyz", true)); assertEquals("", Utils.convertDateFormat("20171020", "", true)); } | public static String convertDateFormat(String date, boolean suppressException) { try { return UI_DF.format(DB_DF.parse(date)); } catch (ParseException e) { if (!suppressException) throw new RuntimeException(e); } return ""; } | Utils { public static String convertDateFormat(String date, boolean suppressException) { try { return UI_DF.format(DB_DF.parse(date)); } catch (ParseException e) { if (!suppressException) throw new RuntimeException(e); } return ""; } } | Utils { public static String convertDateFormat(String date, boolean suppressException) { try { return UI_DF.format(DB_DF.parse(date)); } catch (ParseException e) { if (!suppressException) throw new RuntimeException(e); } return ""; } } | Utils { public static String convertDateFormat(String date, boolean suppressException) { try { return UI_DF.format(DB_DF.parse(date)); } catch (ParseException e) { if (!suppressException) throw new RuntimeException(e); } return ""; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static String convertDateFormat(String date, boolean suppressException) { try { return UI_DF.format(DB_DF.parse(date)); } catch (ParseException e) { if (!suppressException) throw new RuntimeException(e); } return ""; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void assertConvertDateFormatReturnsDate() throws Exception { DateTime dateTime = new DateTime(0l); assertEquals("01-01-1970", Utils.convertDateFormat(dateTime)); } | public static String convertDateFormat(String date, boolean suppressException) { try { return UI_DF.format(DB_DF.parse(date)); } catch (ParseException e) { if (!suppressException) throw new RuntimeException(e); } return ""; } | Utils { public static String convertDateFormat(String date, boolean suppressException) { try { return UI_DF.format(DB_DF.parse(date)); } catch (ParseException e) { if (!suppressException) throw new RuntimeException(e); } return ""; } } | Utils { public static String convertDateFormat(String date, boolean suppressException) { try { return UI_DF.format(DB_DF.parse(date)); } catch (ParseException e) { if (!suppressException) throw new RuntimeException(e); } return ""; } } | Utils { public static String convertDateFormat(String date, boolean suppressException) { try { return UI_DF.format(DB_DF.parse(date)); } catch (ParseException e) { if (!suppressException) throw new RuntimeException(e); } return ""; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static String convertDateFormat(String date, boolean suppressException) { try { return UI_DF.format(DB_DF.parse(date)); } catch (ParseException e) { if (!suppressException) throw new RuntimeException(e); } return ""; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void assertConvertDateTimeFormatReturnsDate() throws Exception { assertEquals("24-07-1985 00:00:00", Utils.convertDateTimeFormat("1985-07-24T00:00:00.000Z", true)); } | public static String convertDateTimeFormat(String date, boolean suppressException) { try { return UI_DTF.format(DB_DTF.parse(date.replace("T", " "))); } catch (ParseException e) { e.printStackTrace(); if (!suppressException) throw new RuntimeException(e); } return ""; } | Utils { public static String convertDateTimeFormat(String date, boolean suppressException) { try { return UI_DTF.format(DB_DTF.parse(date.replace("T", " "))); } catch (ParseException e) { e.printStackTrace(); if (!suppressException) throw new RuntimeException(e); } return ""; } } | Utils { public static String convertDateTimeFormat(String date, boolean suppressException) { try { return UI_DTF.format(DB_DTF.parse(date.replace("T", " "))); } catch (ParseException e) { e.printStackTrace(); if (!suppressException) throw new RuntimeException(e); } return ""; } } | Utils { public static String convertDateTimeFormat(String date, boolean suppressException) { try { return UI_DTF.format(DB_DTF.parse(date.replace("T", " "))); } catch (ParseException e) { e.printStackTrace(); if (!suppressException) throw new RuntimeException(e); } return ""; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static String convertDateTimeFormat(String date, boolean suppressException) { try { return UI_DTF.format(DB_DTF.parse(date.replace("T", " "))); } catch (ParseException e) { e.printStackTrace(); if (!suppressException) throw new RuntimeException(e); } return ""; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test(expected = RuntimeException.class) public void assertConvertDateTimeFormatThrowsExceptionIfUnpasrsableDate() { Utils.convertDateTimeFormat("1985-07-24XXXYYY", false); } | public static String convertDateTimeFormat(String date, boolean suppressException) { try { return UI_DTF.format(DB_DTF.parse(date.replace("T", " "))); } catch (ParseException e) { e.printStackTrace(); if (!suppressException) throw new RuntimeException(e); } return ""; } | Utils { public static String convertDateTimeFormat(String date, boolean suppressException) { try { return UI_DTF.format(DB_DTF.parse(date.replace("T", " "))); } catch (ParseException e) { e.printStackTrace(); if (!suppressException) throw new RuntimeException(e); } return ""; } } | Utils { public static String convertDateTimeFormat(String date, boolean suppressException) { try { return UI_DTF.format(DB_DTF.parse(date.replace("T", " "))); } catch (ParseException e) { e.printStackTrace(); if (!suppressException) throw new RuntimeException(e); } return ""; } } | Utils { public static String convertDateTimeFormat(String date, boolean suppressException) { try { return UI_DTF.format(DB_DTF.parse(date.replace("T", " "))); } catch (ParseException e) { e.printStackTrace(); if (!suppressException) throw new RuntimeException(e); } return ""; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static String convertDateTimeFormat(String date, boolean suppressException) { try { return UI_DTF.format(DB_DTF.parse(date.replace("T", " "))); } catch (ParseException e) { e.printStackTrace(); if (!suppressException) throw new RuntimeException(e); } return ""; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void assertFillValueFromHashMapReturnsValue() { android.widget.TextView view = new android.widget.TextView(RuntimeEnvironment.application); HashMap<String, String> map = new HashMap<String, String>(); String field = "field"; map.put(field, "2017-10-20"); Utils.fillValue(view, map, field, true); assertEquals("2017-10-20", view.getText()); map.put(field, ""); Utils.fillValue(view, map, field, "default", true); assertEquals("default", view.getText()); } | public static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize) { v.setText(getValue(cm, field, humanize)); } | Utils { public static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize) { v.setText(getValue(cm, field, humanize)); } } | Utils { public static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize) { v.setText(getValue(cm, field, humanize)); } } | Utils { public static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize) { v.setText(getValue(cm, field, humanize)); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize) { v.setText(getValue(cm, field, humanize)); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void assertFillValueFromCommonPersonObjectClientReturnsValue() { android.widget.TextView view = new android.widget.TextView(RuntimeEnvironment.application); String field = "field"; HashMap<String, String> map = new HashMap<String, String>(); map.put(field, "2017-10-20"); CommonPersonObjectClient cm = new CommonPersonObjectClient("", map, "NAME"); Utils.fillValue(view, cm, field, true); assertEquals("2017-10-20", view.getText()); map.put(field, ""); cm.setDetails(map); Utils.fillValue(view, cm, field, "default", true); assertEquals("default", view.getText()); } | public static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize) { v.setText(getValue(cm, field, humanize)); } | Utils { public static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize) { v.setText(getValue(cm, field, humanize)); } } | Utils { public static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize) { v.setText(getValue(cm, field, humanize)); } } | Utils { public static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize) { v.setText(getValue(cm, field, humanize)); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize) { v.setText(getValue(cm, field, humanize)); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void assertFillValueTextFieldReturnsValue() throws Exception { android.widget.TextView view = new android.widget.TextView(RuntimeEnvironment.application); String value = "value"; view.setText(value); Utils.fillValue(view, value); assertEquals(value, view.getText()); } | public static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize) { v.setText(getValue(cm, field, humanize)); } | Utils { public static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize) { v.setText(getValue(cm, field, humanize)); } } | Utils { public static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize) { v.setText(getValue(cm, field, humanize)); } } | Utils { public static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize) { v.setText(getValue(cm, field, humanize)); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize) { v.setText(getValue(cm, field, humanize)); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void assertFormatValueReturnsValue() { assertEquals("", Utils.formatValue(null, true)); assertEquals("Abc-def", Utils.formatValue("abc-def", true)); assertEquals("abc-def", Utils.formatValue("abc-def", false)); } | public static String formatValue(String value, boolean humanize) { if (value == null) { value = ""; } return humanize ? WordUtils.capitalize(StringUtil.humanize(value)) : value; } | Utils { public static String formatValue(String value, boolean humanize) { if (value == null) { value = ""; } return humanize ? WordUtils.capitalize(StringUtil.humanize(value)) : value; } } | Utils { public static String formatValue(String value, boolean humanize) { if (value == null) { value = ""; } return humanize ? WordUtils.capitalize(StringUtil.humanize(value)) : value; } } | Utils { public static String formatValue(String value, boolean humanize) { if (value == null) { value = ""; } return humanize ? WordUtils.capitalize(StringUtil.humanize(value)) : value; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static String formatValue(String value, boolean humanize) { if (value == null) { value = ""; } return humanize ? WordUtils.capitalize(StringUtil.humanize(value)) : value; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void assertFormatValueObjectReturnsValue() { assertEquals("", Utils.formatValue((Object) null, true)); assertEquals("Abc-def", Utils.formatValue((Object) new String("abc-def"), true)); assertEquals("abc-def", Utils.formatValue((Object) new String("abc-def"), false)); } | public static String formatValue(String value, boolean humanize) { if (value == null) { value = ""; } return humanize ? WordUtils.capitalize(StringUtil.humanize(value)) : value; } | Utils { public static String formatValue(String value, boolean humanize) { if (value == null) { value = ""; } return humanize ? WordUtils.capitalize(StringUtil.humanize(value)) : value; } } | Utils { public static String formatValue(String value, boolean humanize) { if (value == null) { value = ""; } return humanize ? WordUtils.capitalize(StringUtil.humanize(value)) : value; } } | Utils { public static String formatValue(String value, boolean humanize) { if (value == null) { value = ""; } return humanize ? WordUtils.capitalize(StringUtil.humanize(value)) : value; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static String formatValue(String value, boolean humanize) { if (value == null) { value = ""; } return humanize ? WordUtils.capitalize(StringUtil.humanize(value)) : value; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void testGetScreenDpiReturnsCorrectValuesForExtraHighDensity() { Mockito.doReturn(resources).when(context).getResources(); DisplayMetrics displayMetrics = new DisplayMetrics(); displayMetrics.density = 1.6f; Mockito.doReturn(displayMetrics).when(resources).getDisplayMetrics(); DisplayUtils.ScreenDpi screenDpi = DisplayUtils.getScreenDpi(context); Assert.assertEquals(DisplayUtils.ScreenDpi.XHDPI, screenDpi); displayMetrics = new DisplayMetrics(); displayMetrics.density = 2.0f; Mockito.doReturn(displayMetrics).when(resources).getDisplayMetrics(); screenDpi = DisplayUtils.getScreenDpi(context); Assert.assertEquals(DisplayUtils.ScreenDpi.XHDPI, screenDpi); } | public static ScreenDpi getScreenDpi(Context context) { float density = context.getResources().getDisplayMetrics().density; ScreenDpi dpi = ScreenDpi.XXXHDPI; if (density <= 0.75) { dpi = ScreenDpi.LDPI; } else if (density > 0.75 && density <= 1.0) { dpi = ScreenDpi.MDPI; } else if (density > 1.0 && density <= 1.5) { dpi = ScreenDpi.HDPI; } else if (density > 1.5 && density <= 2.0) { dpi = ScreenDpi.XHDPI; } else if (density > 2.0 && density <= 3.0) { dpi = ScreenDpi.XXHDPI; } return dpi; } | DisplayUtils { public static ScreenDpi getScreenDpi(Context context) { float density = context.getResources().getDisplayMetrics().density; ScreenDpi dpi = ScreenDpi.XXXHDPI; if (density <= 0.75) { dpi = ScreenDpi.LDPI; } else if (density > 0.75 && density <= 1.0) { dpi = ScreenDpi.MDPI; } else if (density > 1.0 && density <= 1.5) { dpi = ScreenDpi.HDPI; } else if (density > 1.5 && density <= 2.0) { dpi = ScreenDpi.XHDPI; } else if (density > 2.0 && density <= 3.0) { dpi = ScreenDpi.XXHDPI; } return dpi; } } | DisplayUtils { public static ScreenDpi getScreenDpi(Context context) { float density = context.getResources().getDisplayMetrics().density; ScreenDpi dpi = ScreenDpi.XXXHDPI; if (density <= 0.75) { dpi = ScreenDpi.LDPI; } else if (density > 0.75 && density <= 1.0) { dpi = ScreenDpi.MDPI; } else if (density > 1.0 && density <= 1.5) { dpi = ScreenDpi.HDPI; } else if (density > 1.5 && density <= 2.0) { dpi = ScreenDpi.XHDPI; } else if (density > 2.0 && density <= 3.0) { dpi = ScreenDpi.XXHDPI; } return dpi; } } | DisplayUtils { public static ScreenDpi getScreenDpi(Context context) { float density = context.getResources().getDisplayMetrics().density; ScreenDpi dpi = ScreenDpi.XXXHDPI; if (density <= 0.75) { dpi = ScreenDpi.LDPI; } else if (density > 0.75 && density <= 1.0) { dpi = ScreenDpi.MDPI; } else if (density > 1.0 && density <= 1.5) { dpi = ScreenDpi.HDPI; } else if (density > 1.5 && density <= 2.0) { dpi = ScreenDpi.XHDPI; } else if (density > 2.0 && density <= 3.0) { dpi = ScreenDpi.XXHDPI; } return dpi; } static ScreenDpi getScreenDpi(Context context); static int getDisplayWidth(Activity activity); static int getDisplayHeight(Activity activity); static double getScreenSize(Activity activity); } | DisplayUtils { public static ScreenDpi getScreenDpi(Context context) { float density = context.getResources().getDisplayMetrics().density; ScreenDpi dpi = ScreenDpi.XXXHDPI; if (density <= 0.75) { dpi = ScreenDpi.LDPI; } else if (density > 0.75 && density <= 1.0) { dpi = ScreenDpi.MDPI; } else if (density > 1.0 && density <= 1.5) { dpi = ScreenDpi.HDPI; } else if (density > 1.5 && density <= 2.0) { dpi = ScreenDpi.XHDPI; } else if (density > 2.0 && density <= 3.0) { dpi = ScreenDpi.XXHDPI; } return dpi; } static ScreenDpi getScreenDpi(Context context); static int getDisplayWidth(Activity activity); static int getDisplayHeight(Activity activity); static double getScreenSize(Activity activity); } |
@Test public void assertGetValueReturnsValue() { String field = "field"; HashMap<String, String> map = new HashMap<String, String>(); map.put(field, "2017-10-20"); CommonPersonObjectClient cm = new CommonPersonObjectClient("", map, "NAME"); assertEquals(Utils.getValue(cm, field, "default", true), "2017-10-20"); map.put(field, ""); assertEquals(Utils.getValue(cm, field, "default", true), "default"); } | public static String getValue(CommonPersonObjectClient pc, String field, boolean humanize) { return formatValue(pc.getDetails().get(field), humanize); } | Utils { public static String getValue(CommonPersonObjectClient pc, String field, boolean humanize) { return formatValue(pc.getDetails().get(field), humanize); } } | Utils { public static String getValue(CommonPersonObjectClient pc, String field, boolean humanize) { return formatValue(pc.getDetails().get(field), humanize); } } | Utils { public static String getValue(CommonPersonObjectClient pc, String field, boolean humanize) { return formatValue(pc.getDetails().get(field), humanize); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static String getValue(CommonPersonObjectClient pc, String field, boolean humanize) { return formatValue(pc.getDetails().get(field), humanize); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void assertGetValueMapReturnsValue() { String field = "field"; HashMap<String, String> map = new HashMap<String, String>(); map.put(field, "2017-10-20"); assertEquals(Utils.getValue(map, field, "default", true), "2017-10-20"); map.put(field, ""); assertEquals(Utils.getValue(map, field, "default", true), "default"); } | public static String getValue(CommonPersonObjectClient pc, String field, boolean humanize) { return formatValue(pc.getDetails().get(field), humanize); } | Utils { public static String getValue(CommonPersonObjectClient pc, String field, boolean humanize) { return formatValue(pc.getDetails().get(field), humanize); } } | Utils { public static String getValue(CommonPersonObjectClient pc, String field, boolean humanize) { return formatValue(pc.getDetails().get(field), humanize); } } | Utils { public static String getValue(CommonPersonObjectClient pc, String field, boolean humanize) { return formatValue(pc.getDetails().get(field), humanize); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static String getValue(CommonPersonObjectClient pc, String field, boolean humanize) { return formatValue(pc.getDetails().get(field), humanize); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void assertNotEmptyValueReturnsValue() { String field = "field"; HashMap<String, String> map = new HashMap<String, String>(); map.put(field, "2017-10-20"); assertEquals(Utils.nonEmptyValue(map, false, true, new String[]{field}), "2017-10-20"); map.put(field, ""); assertEquals(Utils.nonEmptyValue(map, false, true, new String[]{field}), ""); } | public static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields) { List<String> l = Arrays.asList(fields); if (!asc) { Collections.reverse(l); } for (String f : l) { String v = getValue(cm, f, humanize); if (v != "") { return v; } } return ""; } | Utils { public static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields) { List<String> l = Arrays.asList(fields); if (!asc) { Collections.reverse(l); } for (String f : l) { String v = getValue(cm, f, humanize); if (v != "") { return v; } } return ""; } } | Utils { public static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields) { List<String> l = Arrays.asList(fields); if (!asc) { Collections.reverse(l); } for (String f : l) { String v = getValue(cm, f, humanize); if (v != "") { return v; } } return ""; } } | Utils { public static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields) { List<String> l = Arrays.asList(fields); if (!asc) { Collections.reverse(l); } for (String f : l) { String v = getValue(cm, f, humanize); if (v != "") { return v; } } return ""; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields) { List<String> l = Arrays.asList(fields); if (!asc) { Collections.reverse(l); } for (String f : l) { String v = getValue(cm, f, humanize); if (v != "") { return v; } } return ""; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void assertHasEmptyValueReturnsBoolean() throws Exception { String field = "field"; HashMap<String, String> map = new HashMap<String, String>(); map.put(field, ""); assertEquals(Utils.hasAnyEmptyValue(map, "", new String[]{field}), true); map.put(field, "2017-10-20"); assertEquals(Utils.hasAnyEmptyValue(map, "x", new String[]{field}), false); } | public static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields) { List<String> l = Arrays.asList(fields); for (String f : l) { String v = getValue(cm, f, false); if (v == "" && (StringUtils.isBlank(postFix) || StringUtils.isBlank(getValue(cm, f + postFix, false)))) { return true; } } return false; } | Utils { public static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields) { List<String> l = Arrays.asList(fields); for (String f : l) { String v = getValue(cm, f, false); if (v == "" && (StringUtils.isBlank(postFix) || StringUtils.isBlank(getValue(cm, f + postFix, false)))) { return true; } } return false; } } | Utils { public static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields) { List<String> l = Arrays.asList(fields); for (String f : l) { String v = getValue(cm, f, false); if (v == "" && (StringUtils.isBlank(postFix) || StringUtils.isBlank(getValue(cm, f + postFix, false)))) { return true; } } return false; } } | Utils { public static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields) { List<String> l = Arrays.asList(fields); for (String f : l) { String v = getValue(cm, f, false); if (v == "" && (StringUtils.isBlank(postFix) || StringUtils.isBlank(getValue(cm, f + postFix, false)))) { return true; } } return false; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields) { List<String> l = Arrays.asList(fields); for (String f : l) { String v = getValue(cm, f, false); if (v == "" && (StringUtils.isBlank(postFix) || StringUtils.isBlank(getValue(cm, f + postFix, false)))) { return true; } } return false; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void assertAddToIntReturnsSum() { assertEquals(Utils.addAsInts(true, new String[]{""}), 0); assertEquals(Utils.addAsInts(true, new String[]{"1", "1", "1"}), 3); } | public static int addAsInts(boolean ignoreEmpty, String... vals) { int i = 0; for (String v : vals) { i += ignoreEmpty && StringUtils.isBlank(v) ? 0 : Integer.parseInt(v); } return i; } | Utils { public static int addAsInts(boolean ignoreEmpty, String... vals) { int i = 0; for (String v : vals) { i += ignoreEmpty && StringUtils.isBlank(v) ? 0 : Integer.parseInt(v); } return i; } } | Utils { public static int addAsInts(boolean ignoreEmpty, String... vals) { int i = 0; for (String v : vals) { i += ignoreEmpty && StringUtils.isBlank(v) ? 0 : Integer.parseInt(v); } return i; } } | Utils { public static int addAsInts(boolean ignoreEmpty, String... vals) { int i = 0; for (String v : vals) { i += ignoreEmpty && StringUtils.isBlank(v) ? 0 : Integer.parseInt(v); } return i; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static int addAsInts(boolean ignoreEmpty, String... vals) { int i = 0; for (String v : vals) { i += ignoreEmpty && StringUtils.isBlank(v) ? 0 : Integer.parseInt(v); } return i; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void assertAddToRowReturnsTableRow() { TableRow mockRow = new TableRow(RuntimeEnvironment.application); TableRow row = Utils.addToRow(RuntimeEnvironment.application, "hello world", mockRow); assertEquals(mockRow, row); android.widget.TextView view = (android.widget.TextView) row.getChildAt(0); assertEquals(view.getText().toString(), "hello world"); } | public static TableRow addToRow(Context context, String value, TableRow row) { return addToRow(context, value, row, false, 1); } | Utils { public static TableRow addToRow(Context context, String value, TableRow row) { return addToRow(context, value, row, false, 1); } } | Utils { public static TableRow addToRow(Context context, String value, TableRow row) { return addToRow(context, value, row, false, 1); } } | Utils { public static TableRow addToRow(Context context, String value, TableRow row) { return addToRow(context, value, row, false, 1); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static TableRow addToRow(Context context, String value, TableRow row) { return addToRow(context, value, row, false, 1); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void assertAddToRowWeihtReturnsTableRow() { TableRow mockRow = new TableRow(RuntimeEnvironment.application); TableRow row = Utils.addToRow(RuntimeEnvironment.application, "hello world", mockRow, 25); assertEquals(mockRow, row); android.widget.TextView view = (android.widget.TextView) row.getChildAt(0); assertEquals(view.getText().toString(), "hello world"); } | public static TableRow addToRow(Context context, String value, TableRow row) { return addToRow(context, value, row, false, 1); } | Utils { public static TableRow addToRow(Context context, String value, TableRow row) { return addToRow(context, value, row, false, 1); } } | Utils { public static TableRow addToRow(Context context, String value, TableRow row) { return addToRow(context, value, row, false, 1); } } | Utils { public static TableRow addToRow(Context context, String value, TableRow row) { return addToRow(context, value, row, false, 1); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static TableRow addToRow(Context context, String value, TableRow row) { return addToRow(context, value, row, false, 1); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void assertAddToRowcompatReturnsTableRow() { TableRow mockRow = new TableRow(RuntimeEnvironment.application); TableRow row = Utils.addToRow(RuntimeEnvironment.application, "hello world", mockRow, true); assertEquals(mockRow, row); android.widget.TextView view = (android.widget.TextView) row.getChildAt(0); assertEquals(view.getText().toString(), "hello world"); } | public static TableRow addToRow(Context context, String value, TableRow row) { return addToRow(context, value, row, false, 1); } | Utils { public static TableRow addToRow(Context context, String value, TableRow row) { return addToRow(context, value, row, false, 1); } } | Utils { public static TableRow addToRow(Context context, String value, TableRow row) { return addToRow(context, value, row, false, 1); } } | Utils { public static TableRow addToRow(Context context, String value, TableRow row) { return addToRow(context, value, row, false, 1); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static TableRow addToRow(Context context, String value, TableRow row) { return addToRow(context, value, row, false, 1); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void assertAddToRowWeightCompatReturnsTableRow() { TableRow mockRow = new TableRow(RuntimeEnvironment.application); TableRow row = Utils.addToRow(RuntimeEnvironment.application, "<b>hello world</b>", mockRow, true, 25); assertEquals(mockRow, row); android.widget.TextView view = (android.widget.TextView) row.getChildAt(0); assertEquals(view.getText().toString(), "hello world"); } | public static TableRow addToRow(Context context, String value, TableRow row) { return addToRow(context, value, row, false, 1); } | Utils { public static TableRow addToRow(Context context, String value, TableRow row) { return addToRow(context, value, row, false, 1); } } | Utils { public static TableRow addToRow(Context context, String value, TableRow row) { return addToRow(context, value, row, false, 1); } } | Utils { public static TableRow addToRow(Context context, String value, TableRow row) { return addToRow(context, value, row, false, 1); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static TableRow addToRow(Context context, String value, TableRow row) { return addToRow(context, value, row, false, 1); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void testCompleteSyncIntent() throws Exception { Intent intent = new Intent(); assertEquals(intent.getExtras(), null); intent.setAction(SyncStatusBroadcastReceiver.ACTION_SYNC_STATUS); intent.putExtra(SyncStatusBroadcastReceiver.EXTRA_FETCH_STATUS, FetchStatus.fetched); intent.putExtra(SyncStatusBroadcastReceiver.EXTRA_COMPLETE_STATUS, true); Intent UtilIntent = Utils.completeSync(FetchStatus.fetched); Assert.assertSame(intent.getExtras().get("complete_status"), UtilIntent.getExtras().get("complete_status")); Assert.assertSame(intent.getExtras().get("fetch_status"), UtilIntent.getExtras().get("fetch_status")); assertEquals(FetchStatus.fetched, UtilIntent.getExtras().get("fetch_status")); Assert.assertSame(SyncStatusBroadcastReceiver.ACTION_SYNC_STATUS, UtilIntent.getAction()); Assert.assertSame(0, Utils.completeSync(FetchStatus.fetched).getFlags()); } | public static Intent completeSync(FetchStatus fetchStatus) { Intent intent = new Intent(); intent.setAction(SyncStatusBroadcastReceiver.ACTION_SYNC_STATUS); intent.putExtra(SyncStatusBroadcastReceiver.EXTRA_FETCH_STATUS, fetchStatus); intent.putExtra(SyncStatusBroadcastReceiver.EXTRA_COMPLETE_STATUS, true); return intent; } | Utils { public static Intent completeSync(FetchStatus fetchStatus) { Intent intent = new Intent(); intent.setAction(SyncStatusBroadcastReceiver.ACTION_SYNC_STATUS); intent.putExtra(SyncStatusBroadcastReceiver.EXTRA_FETCH_STATUS, fetchStatus); intent.putExtra(SyncStatusBroadcastReceiver.EXTRA_COMPLETE_STATUS, true); return intent; } } | Utils { public static Intent completeSync(FetchStatus fetchStatus) { Intent intent = new Intent(); intent.setAction(SyncStatusBroadcastReceiver.ACTION_SYNC_STATUS); intent.putExtra(SyncStatusBroadcastReceiver.EXTRA_FETCH_STATUS, fetchStatus); intent.putExtra(SyncStatusBroadcastReceiver.EXTRA_COMPLETE_STATUS, true); return intent; } } | Utils { public static Intent completeSync(FetchStatus fetchStatus) { Intent intent = new Intent(); intent.setAction(SyncStatusBroadcastReceiver.ACTION_SYNC_STATUS); intent.putExtra(SyncStatusBroadcastReceiver.EXTRA_FETCH_STATUS, fetchStatus); intent.putExtra(SyncStatusBroadcastReceiver.EXTRA_COMPLETE_STATUS, true); return intent; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static Intent completeSync(FetchStatus fetchStatus) { Intent intent = new Intent(); intent.setAction(SyncStatusBroadcastReceiver.ACTION_SYNC_STATUS); intent.putExtra(SyncStatusBroadcastReceiver.EXTRA_FETCH_STATUS, fetchStatus); intent.putExtra(SyncStatusBroadcastReceiver.EXTRA_COMPLETE_STATUS, true); return intent; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void testGetScreenDpiReturnsCorrectValuesForExtraExtraHighDensity() { Mockito.doReturn(resources).when(context).getResources(); DisplayMetrics displayMetrics = new DisplayMetrics(); displayMetrics.density = 2.1f; Mockito.doReturn(displayMetrics).when(resources).getDisplayMetrics(); DisplayUtils.ScreenDpi screenDpi = DisplayUtils.getScreenDpi(context); Assert.assertEquals(DisplayUtils.ScreenDpi.XXHDPI, screenDpi); displayMetrics = new DisplayMetrics(); displayMetrics.density = 3.0f; Mockito.doReturn(displayMetrics).when(resources).getDisplayMetrics(); screenDpi = DisplayUtils.getScreenDpi(context); Assert.assertEquals(DisplayUtils.ScreenDpi.XXHDPI, screenDpi); } | public static ScreenDpi getScreenDpi(Context context) { float density = context.getResources().getDisplayMetrics().density; ScreenDpi dpi = ScreenDpi.XXXHDPI; if (density <= 0.75) { dpi = ScreenDpi.LDPI; } else if (density > 0.75 && density <= 1.0) { dpi = ScreenDpi.MDPI; } else if (density > 1.0 && density <= 1.5) { dpi = ScreenDpi.HDPI; } else if (density > 1.5 && density <= 2.0) { dpi = ScreenDpi.XHDPI; } else if (density > 2.0 && density <= 3.0) { dpi = ScreenDpi.XXHDPI; } return dpi; } | DisplayUtils { public static ScreenDpi getScreenDpi(Context context) { float density = context.getResources().getDisplayMetrics().density; ScreenDpi dpi = ScreenDpi.XXXHDPI; if (density <= 0.75) { dpi = ScreenDpi.LDPI; } else if (density > 0.75 && density <= 1.0) { dpi = ScreenDpi.MDPI; } else if (density > 1.0 && density <= 1.5) { dpi = ScreenDpi.HDPI; } else if (density > 1.5 && density <= 2.0) { dpi = ScreenDpi.XHDPI; } else if (density > 2.0 && density <= 3.0) { dpi = ScreenDpi.XXHDPI; } return dpi; } } | DisplayUtils { public static ScreenDpi getScreenDpi(Context context) { float density = context.getResources().getDisplayMetrics().density; ScreenDpi dpi = ScreenDpi.XXXHDPI; if (density <= 0.75) { dpi = ScreenDpi.LDPI; } else if (density > 0.75 && density <= 1.0) { dpi = ScreenDpi.MDPI; } else if (density > 1.0 && density <= 1.5) { dpi = ScreenDpi.HDPI; } else if (density > 1.5 && density <= 2.0) { dpi = ScreenDpi.XHDPI; } else if (density > 2.0 && density <= 3.0) { dpi = ScreenDpi.XXHDPI; } return dpi; } } | DisplayUtils { public static ScreenDpi getScreenDpi(Context context) { float density = context.getResources().getDisplayMetrics().density; ScreenDpi dpi = ScreenDpi.XXXHDPI; if (density <= 0.75) { dpi = ScreenDpi.LDPI; } else if (density > 0.75 && density <= 1.0) { dpi = ScreenDpi.MDPI; } else if (density > 1.0 && density <= 1.5) { dpi = ScreenDpi.HDPI; } else if (density > 1.5 && density <= 2.0) { dpi = ScreenDpi.XHDPI; } else if (density > 2.0 && density <= 3.0) { dpi = ScreenDpi.XXHDPI; } return dpi; } static ScreenDpi getScreenDpi(Context context); static int getDisplayWidth(Activity activity); static int getDisplayHeight(Activity activity); static double getScreenSize(Activity activity); } | DisplayUtils { public static ScreenDpi getScreenDpi(Context context) { float density = context.getResources().getDisplayMetrics().density; ScreenDpi dpi = ScreenDpi.XXXHDPI; if (density <= 0.75) { dpi = ScreenDpi.LDPI; } else if (density > 0.75 && density <= 1.0) { dpi = ScreenDpi.MDPI; } else if (density > 1.0 && density <= 1.5) { dpi = ScreenDpi.HDPI; } else if (density > 1.5 && density <= 2.0) { dpi = ScreenDpi.XHDPI; } else if (density > 2.0 && density <= 3.0) { dpi = ScreenDpi.XXHDPI; } return dpi; } static ScreenDpi getScreenDpi(Context context); static int getDisplayWidth(Activity activity); static int getDisplayHeight(Activity activity); static double getScreenSize(Activity activity); } |
@Test public void testKgStringSuffixReturnsCorrectValueIfParamFloat() { String result = Utils.kgStringSuffix(2.5f); Assert.assertNotNull(result); assertEquals("2.5 kg", result); } | public static String kgStringSuffix(Float weight) { return String.format(KG_FORMAT, weight); } | Utils { public static String kgStringSuffix(Float weight) { return String.format(KG_FORMAT, weight); } } | Utils { public static String kgStringSuffix(Float weight) { return String.format(KG_FORMAT, weight); } } | Utils { public static String kgStringSuffix(Float weight) { return String.format(KG_FORMAT, weight); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static String kgStringSuffix(Float weight) { return String.format(KG_FORMAT, weight); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void testKgStringSuffixReturnsCorrectValueIfParamString() { String result = Utils.kgStringSuffix("3.4"); Assert.assertNotNull(result); assertEquals("3.4 kg", result); } | public static String kgStringSuffix(Float weight) { return String.format(KG_FORMAT, weight); } | Utils { public static String kgStringSuffix(Float weight) { return String.format(KG_FORMAT, weight); } } | Utils { public static String kgStringSuffix(Float weight) { return String.format(KG_FORMAT, weight); } } | Utils { public static String kgStringSuffix(Float weight) { return String.format(KG_FORMAT, weight); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static String kgStringSuffix(Float weight) { return String.format(KG_FORMAT, weight); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void testCmStringSuffixReturnsCorrectValueIfParamFloat() { String result = Utils.cmStringSuffix(1.5f); Assert.assertNotNull(result); assertEquals("1.5 cm", result); } | public static String cmStringSuffix(Float height) { return String.format(CM_FORMAT, height); } | Utils { public static String cmStringSuffix(Float height) { return String.format(CM_FORMAT, height); } } | Utils { public static String cmStringSuffix(Float height) { return String.format(CM_FORMAT, height); } } | Utils { public static String cmStringSuffix(Float height) { return String.format(CM_FORMAT, height); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static String cmStringSuffix(Float height) { return String.format(CM_FORMAT, height); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void testCmStringSuffixReturnsCorrectValueIfParamString() { String result = Utils.cmStringSuffix("45.9"); Assert.assertNotNull(result); assertEquals("45.9 cm", result); } | public static String cmStringSuffix(Float height) { return String.format(CM_FORMAT, height); } | Utils { public static String cmStringSuffix(Float height) { return String.format(CM_FORMAT, height); } } | Utils { public static String cmStringSuffix(Float height) { return String.format(CM_FORMAT, height); } } | Utils { public static String cmStringSuffix(Float height) { return String.format(CM_FORMAT, height); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static String cmStringSuffix(Float height) { return String.format(CM_FORMAT, height); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void testGetVersionCodeShouldGetCorrectVersionCode() throws PackageManager.NameNotFoundException { Context context = getContext(40); assertEquals(Utils.getVersionCode(context), 40); } | public static long getVersionCode(Context context) throws PackageManager.NameNotFoundException { PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); return packageInfo.versionCode; } | Utils { public static long getVersionCode(Context context) throws PackageManager.NameNotFoundException { PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); return packageInfo.versionCode; } } | Utils { public static long getVersionCode(Context context) throws PackageManager.NameNotFoundException { PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); return packageInfo.versionCode; } } | Utils { public static long getVersionCode(Context context) throws PackageManager.NameNotFoundException { PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); return packageInfo.versionCode; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static long getVersionCode(Context context) throws PackageManager.NameNotFoundException { PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); return packageInfo.versionCode; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void testIs2xxSuccessfulShouldReturnCorrectStatus() { assertTrue(Utils.is2xxSuccessful(200)); assertTrue(Utils.is2xxSuccessful(203)); assertTrue(Utils.is2xxSuccessful(207)); assertFalse(Utils.is2xxSuccessful(300)); } | public static boolean is2xxSuccessful(int httpStatus) { return httpStatus >= HttpStatus.SC_OK && httpStatus <= HttpStatus.SC_MULTI_STATUS; } | Utils { public static boolean is2xxSuccessful(int httpStatus) { return httpStatus >= HttpStatus.SC_OK && httpStatus <= HttpStatus.SC_MULTI_STATUS; } } | Utils { public static boolean is2xxSuccessful(int httpStatus) { return httpStatus >= HttpStatus.SC_OK && httpStatus <= HttpStatus.SC_MULTI_STATUS; } } | Utils { public static boolean is2xxSuccessful(int httpStatus) { return httpStatus >= HttpStatus.SC_OK && httpStatus <= HttpStatus.SC_MULTI_STATUS; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static boolean is2xxSuccessful(int httpStatus) { return httpStatus >= HttpStatus.SC_OK && httpStatus <= HttpStatus.SC_MULTI_STATUS; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void testDobStringToDateTimeShouldReturnCorrectDateTime() { assertEquals(Utils.dobStringToDateTime("2000-12-30").toString(), new DateTime("2000-12-30").toString()); } | public static DateTime dobStringToDateTime(String dobString) { try { if (StringUtils.isBlank(dobString)) { return null; } return new DateTime(dobString); } catch (Exception e) { return null; } } | Utils { public static DateTime dobStringToDateTime(String dobString) { try { if (StringUtils.isBlank(dobString)) { return null; } return new DateTime(dobString); } catch (Exception e) { return null; } } } | Utils { public static DateTime dobStringToDateTime(String dobString) { try { if (StringUtils.isBlank(dobString)) { return null; } return new DateTime(dobString); } catch (Exception e) { return null; } } } | Utils { public static DateTime dobStringToDateTime(String dobString) { try { if (StringUtils.isBlank(dobString)) { return null; } return new DateTime(dobString); } catch (Exception e) { return null; } } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static DateTime dobStringToDateTime(String dobString) { try { if (StringUtils.isBlank(dobString)) { return null; } return new DateTime(dobString); } catch (Exception e) { return null; } } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void testGetFilterValueShouldGetCorrectFilterValue() { LoginResponseData loginResponseData = getLoginResponseData(); LoginResponse loginResponse = LoginResponse.SUCCESS.withPayload(loginResponseData); assertEquals(loginResponseData.team.team.uuid, Utils.getFilterValue(loginResponse, SyncFilter.TEAM)); assertEquals(loginResponseData.team.team.uuid, Utils.getFilterValue(loginResponse, SyncFilter.TEAM_ID)); assertEquals(loginResponseData.team.team.location.uuid, Utils.getFilterValue(loginResponse, SyncFilter.LOCATION)); assertEquals(loginResponseData.user.getUsername(), Utils.getFilterValue(loginResponse, SyncFilter.PROVIDER)); } | public static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam) { String filterValue = ""; LoginResponseData response = loginResponse.payload(); switch (syncFilterParam) { case TEAM: case TEAM_ID: filterValue = response.team.team.uuid; break; case LOCATION: filterValue = response.team.team.location.uuid; break; case PROVIDER: filterValue = response.user.getUsername(); break; default: break; } return filterValue; } | Utils { public static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam) { String filterValue = ""; LoginResponseData response = loginResponse.payload(); switch (syncFilterParam) { case TEAM: case TEAM_ID: filterValue = response.team.team.uuid; break; case LOCATION: filterValue = response.team.team.location.uuid; break; case PROVIDER: filterValue = response.user.getUsername(); break; default: break; } return filterValue; } } | Utils { public static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam) { String filterValue = ""; LoginResponseData response = loginResponse.payload(); switch (syncFilterParam) { case TEAM: case TEAM_ID: filterValue = response.team.team.uuid; break; case LOCATION: filterValue = response.team.team.location.uuid; break; case PROVIDER: filterValue = response.user.getUsername(); break; default: break; } return filterValue; } } | Utils { public static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam) { String filterValue = ""; LoginResponseData response = loginResponse.payload(); switch (syncFilterParam) { case TEAM: case TEAM_ID: filterValue = response.team.team.uuid; break; case LOCATION: filterValue = response.team.team.location.uuid; break; case PROVIDER: filterValue = response.user.getUsername(); break; default: break; } return filterValue; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam) { String filterValue = ""; LoginResponseData response = loginResponse.payload(); switch (syncFilterParam) { case TEAM: case TEAM_ID: filterValue = response.team.team.uuid; break; case LOCATION: filterValue = response.team.team.location.uuid; break; case PROVIDER: filterValue = response.user.getUsername(); break; default: break; } return filterValue; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test @Ignore public void testGetPropertiesShouldGetPropertyFile() { AppProperties appProperties = Utils.getProperties(RuntimeEnvironment.application); assertTrue(appProperties.getPropertyBoolean("property_4")); assertEquals("property_1", appProperties.getProperty("property_1")); assertEquals("property_2", appProperties.getProperty("property_2")); assertEquals("property_3", appProperties.getProperty("property_3")); } | public static AppProperties getProperties(Context context) { AppProperties properties = new AppProperties(); try { AssetManager assetManager = context.getAssets(); InputStream inputStream = assetManager.open(APP_PROPERTIES_FILE); properties.load(inputStream); } catch (Exception e) { Timber.e(e); } return properties; } | Utils { public static AppProperties getProperties(Context context) { AppProperties properties = new AppProperties(); try { AssetManager assetManager = context.getAssets(); InputStream inputStream = assetManager.open(APP_PROPERTIES_FILE); properties.load(inputStream); } catch (Exception e) { Timber.e(e); } return properties; } } | Utils { public static AppProperties getProperties(Context context) { AppProperties properties = new AppProperties(); try { AssetManager assetManager = context.getAssets(); InputStream inputStream = assetManager.open(APP_PROPERTIES_FILE); properties.load(inputStream); } catch (Exception e) { Timber.e(e); } return properties; } } | Utils { public static AppProperties getProperties(Context context) { AppProperties properties = new AppProperties(); try { AssetManager assetManager = context.getAssets(); InputStream inputStream = assetManager.open(APP_PROPERTIES_FILE); properties.load(inputStream); } catch (Exception e) { Timber.e(e); } return properties; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static AppProperties getProperties(Context context) { AppProperties properties = new AppProperties(); try { AssetManager assetManager = context.getAssets(); InputStream inputStream = assetManager.open(APP_PROPERTIES_FILE); properties.load(inputStream); } catch (Exception e) { Timber.e(e); } return properties; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void testGetUserDefaultTeamIdShouldGetCorrectTeamId() { LoginResponseData loginResponseData = getLoginResponseData(); assertEquals(loginResponseData.team.team.uuid, Utils.getUserDefaultTeamId(loginResponseData)); } | public static String getUserDefaultTeamId(LoginResponseData userInfo) { try { if (userInfo != null && userInfo.team != null && userInfo.team.team != null) { return userInfo.team.team.uuid; } } catch (Exception e) { Log.v("Error : ", e.getMessage()); } return null; } | Utils { public static String getUserDefaultTeamId(LoginResponseData userInfo) { try { if (userInfo != null && userInfo.team != null && userInfo.team.team != null) { return userInfo.team.team.uuid; } } catch (Exception e) { Log.v("Error : ", e.getMessage()); } return null; } } | Utils { public static String getUserDefaultTeamId(LoginResponseData userInfo) { try { if (userInfo != null && userInfo.team != null && userInfo.team.team != null) { return userInfo.team.team.uuid; } } catch (Exception e) { Log.v("Error : ", e.getMessage()); } return null; } } | Utils { public static String getUserDefaultTeamId(LoginResponseData userInfo) { try { if (userInfo != null && userInfo.team != null && userInfo.team.team != null) { return userInfo.team.team.uuid; } } catch (Exception e) { Log.v("Error : ", e.getMessage()); } return null; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static String getUserDefaultTeamId(LoginResponseData userInfo) { try { if (userInfo != null && userInfo.team != null && userInfo.team.team != null) { return userInfo.team.team.uuid; } } catch (Exception e) { Log.v("Error : ", e.getMessage()); } return null; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void testGetScreenDpiReturnsCorrectValuesForExtraExtraExtraHighDensity() { Mockito.doReturn(resources).when(context).getResources(); DisplayMetrics displayMetrics = new DisplayMetrics(); displayMetrics.density = 3.1f; Mockito.doReturn(displayMetrics).when(resources).getDisplayMetrics(); DisplayUtils.ScreenDpi screenDpi = DisplayUtils.getScreenDpi(context); Assert.assertEquals(DisplayUtils.ScreenDpi.XXXHDPI, screenDpi); displayMetrics = new DisplayMetrics(); displayMetrics.density = 4.0f; Mockito.doReturn(displayMetrics).when(resources).getDisplayMetrics(); screenDpi = DisplayUtils.getScreenDpi(context); Assert.assertEquals(DisplayUtils.ScreenDpi.XXXHDPI, screenDpi); } | public static ScreenDpi getScreenDpi(Context context) { float density = context.getResources().getDisplayMetrics().density; ScreenDpi dpi = ScreenDpi.XXXHDPI; if (density <= 0.75) { dpi = ScreenDpi.LDPI; } else if (density > 0.75 && density <= 1.0) { dpi = ScreenDpi.MDPI; } else if (density > 1.0 && density <= 1.5) { dpi = ScreenDpi.HDPI; } else if (density > 1.5 && density <= 2.0) { dpi = ScreenDpi.XHDPI; } else if (density > 2.0 && density <= 3.0) { dpi = ScreenDpi.XXHDPI; } return dpi; } | DisplayUtils { public static ScreenDpi getScreenDpi(Context context) { float density = context.getResources().getDisplayMetrics().density; ScreenDpi dpi = ScreenDpi.XXXHDPI; if (density <= 0.75) { dpi = ScreenDpi.LDPI; } else if (density > 0.75 && density <= 1.0) { dpi = ScreenDpi.MDPI; } else if (density > 1.0 && density <= 1.5) { dpi = ScreenDpi.HDPI; } else if (density > 1.5 && density <= 2.0) { dpi = ScreenDpi.XHDPI; } else if (density > 2.0 && density <= 3.0) { dpi = ScreenDpi.XXHDPI; } return dpi; } } | DisplayUtils { public static ScreenDpi getScreenDpi(Context context) { float density = context.getResources().getDisplayMetrics().density; ScreenDpi dpi = ScreenDpi.XXXHDPI; if (density <= 0.75) { dpi = ScreenDpi.LDPI; } else if (density > 0.75 && density <= 1.0) { dpi = ScreenDpi.MDPI; } else if (density > 1.0 && density <= 1.5) { dpi = ScreenDpi.HDPI; } else if (density > 1.5 && density <= 2.0) { dpi = ScreenDpi.XHDPI; } else if (density > 2.0 && density <= 3.0) { dpi = ScreenDpi.XXHDPI; } return dpi; } } | DisplayUtils { public static ScreenDpi getScreenDpi(Context context) { float density = context.getResources().getDisplayMetrics().density; ScreenDpi dpi = ScreenDpi.XXXHDPI; if (density <= 0.75) { dpi = ScreenDpi.LDPI; } else if (density > 0.75 && density <= 1.0) { dpi = ScreenDpi.MDPI; } else if (density > 1.0 && density <= 1.5) { dpi = ScreenDpi.HDPI; } else if (density > 1.5 && density <= 2.0) { dpi = ScreenDpi.XHDPI; } else if (density > 2.0 && density <= 3.0) { dpi = ScreenDpi.XXHDPI; } return dpi; } static ScreenDpi getScreenDpi(Context context); static int getDisplayWidth(Activity activity); static int getDisplayHeight(Activity activity); static double getScreenSize(Activity activity); } | DisplayUtils { public static ScreenDpi getScreenDpi(Context context) { float density = context.getResources().getDisplayMetrics().density; ScreenDpi dpi = ScreenDpi.XXXHDPI; if (density <= 0.75) { dpi = ScreenDpi.LDPI; } else if (density > 0.75 && density <= 1.0) { dpi = ScreenDpi.MDPI; } else if (density > 1.0 && density <= 1.5) { dpi = ScreenDpi.HDPI; } else if (density > 1.5 && density <= 2.0) { dpi = ScreenDpi.XHDPI; } else if (density > 2.0 && density <= 3.0) { dpi = ScreenDpi.XXHDPI; } return dpi; } static ScreenDpi getScreenDpi(Context context); static int getDisplayWidth(Activity activity); static int getDisplayHeight(Activity activity); static double getScreenSize(Activity activity); } |
@Test public void testIsEmptyCollectionShouldReturnCorrectStatus() { List<String> list = new ArrayList<>(); list.add("string"); assertFalse(Utils.isEmptyCollection(list)); list.clear(); assertTrue(Utils.isEmptyCollection(list)); } | public static boolean isEmptyCollection(Collection collection) { return collection == null || collection.isEmpty(); } | Utils { public static boolean isEmptyCollection(Collection collection) { return collection == null || collection.isEmpty(); } } | Utils { public static boolean isEmptyCollection(Collection collection) { return collection == null || collection.isEmpty(); } } | Utils { public static boolean isEmptyCollection(Collection collection) { return collection == null || collection.isEmpty(); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static boolean isEmptyCollection(Collection collection) { return collection == null || collection.isEmpty(); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void testIsEmptyMapShouldReturnCorrectStatus() { Map<String, String> map = new HashMap<>(); map.put("key", "string"); assertFalse(Utils.isEmptyMap(map)); map.clear(); assertTrue(Utils.isEmptyMap(map)); } | public static boolean isEmptyMap(Map map) { return map == null || map.isEmpty(); } | Utils { public static boolean isEmptyMap(Map map) { return map == null || map.isEmpty(); } } | Utils { public static boolean isEmptyMap(Map map) { return map == null || map.isEmpty(); } } | Utils { public static boolean isEmptyMap(Map map) { return map == null || map.isEmpty(); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static boolean isEmptyMap(Map map) { return map == null || map.isEmpty(); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void testGetNameShouldGetCorrectlyFormattedName() { assertEquals("John Doe", Utils.getName("John", "Doe")); assertEquals("John", Utils.getName("John", "")); assertEquals("Doe", Utils.getName("", "Doe")); } | public static String getName(@NonNull String firstName, @NonNull String lastName) { return (firstName.trim() + " " + lastName.trim()).trim(); } | Utils { public static String getName(@NonNull String firstName, @NonNull String lastName) { return (firstName.trim() + " " + lastName.trim()).trim(); } } | Utils { public static String getName(@NonNull String firstName, @NonNull String lastName) { return (firstName.trim() + " " + lastName.trim()).trim(); } } | Utils { public static String getName(@NonNull String firstName, @NonNull String lastName) { return (firstName.trim() + " " + lastName.trim()).trim(); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static String getName(@NonNull String firstName, @NonNull String lastName) { return (firstName.trim() + " " + lastName.trim()).trim(); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void testGetAgeFromDateShouldGetCorrectAge() { String date = "2000-12-12"; DateTime dateTime = DateTime.parse(date); assertEquals(Utils.getAgeFromDate(date), Years.yearsBetween(dateTime.toLocalDate(), LocalDate.now()).getYears()); } | public static int getAgeFromDate(String dateOfBirth) { DateTime date = DateTime.parse(dateOfBirth); Years age = Years.yearsBetween(date.toLocalDate(), LocalDate.now()); return age.getYears(); } | Utils { public static int getAgeFromDate(String dateOfBirth) { DateTime date = DateTime.parse(dateOfBirth); Years age = Years.yearsBetween(date.toLocalDate(), LocalDate.now()); return age.getYears(); } } | Utils { public static int getAgeFromDate(String dateOfBirth) { DateTime date = DateTime.parse(dateOfBirth); Years age = Years.yearsBetween(date.toLocalDate(), LocalDate.now()); return age.getYears(); } } | Utils { public static int getAgeFromDate(String dateOfBirth) { DateTime date = DateTime.parse(dateOfBirth); Years age = Years.yearsBetween(date.toLocalDate(), LocalDate.now()); return age.getYears(); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static int getAgeFromDate(String dateOfBirth) { DateTime date = DateTime.parse(dateOfBirth); Years age = Years.yearsBetween(date.toLocalDate(), LocalDate.now()); return age.getYears(); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void testGetDobShouldGetCorrectDob() { int age = 10; String datePattern = "YYYY-MM-dd"; Calendar cal = Calendar.getInstance(); cal.add(Calendar.YEAR, -age); assertEquals(cal.getWeekYear() + "-" + "01" + "-" + "01", Utils.getDob(age, datePattern)); assertEquals("01" + "-" + "01" + "-" + cal.getWeekYear(), Utils.getDob(age)); } | public static String getDob(int age) { return getDob(age, DateUtil.DATE_FORMAT_FOR_TIMELINE_EVENT); } | Utils { public static String getDob(int age) { return getDob(age, DateUtil.DATE_FORMAT_FOR_TIMELINE_EVENT); } } | Utils { public static String getDob(int age) { return getDob(age, DateUtil.DATE_FORMAT_FOR_TIMELINE_EVENT); } } | Utils { public static String getDob(int age) { return getDob(age, DateUtil.DATE_FORMAT_FOR_TIMELINE_EVENT); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static String getDob(int age) { return getDob(age, DateUtil.DATE_FORMAT_FOR_TIMELINE_EVENT); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void testGetAllSharedPreferencesShouldGetPreferences() { assertNotNull(Utils.getAllSharedPreferences()); } | public static AllSharedPreferences getAllSharedPreferences() { return CoreLibrary.getInstance().context().allSharedPreferences(); } | Utils { public static AllSharedPreferences getAllSharedPreferences() { return CoreLibrary.getInstance().context().allSharedPreferences(); } } | Utils { public static AllSharedPreferences getAllSharedPreferences() { return CoreLibrary.getInstance().context().allSharedPreferences(); } } | Utils { public static AllSharedPreferences getAllSharedPreferences() { return CoreLibrary.getInstance().context().allSharedPreferences(); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { public static AllSharedPreferences getAllSharedPreferences() { return CoreLibrary.getInstance().context().allSharedPreferences(); } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void testGetAppIdShouldReturnAppId() { assertEquals("org.smartregister.test", Utils.getAppId(RuntimeEnvironment.application)); } | @Nullable public static String getAppId(@NonNull Context context) { PackageInfo packageInfo = getPackageInfo(context); return packageInfo != null ? packageInfo.packageName : null; } | Utils { @Nullable public static String getAppId(@NonNull Context context) { PackageInfo packageInfo = getPackageInfo(context); return packageInfo != null ? packageInfo.packageName : null; } } | Utils { @Nullable public static String getAppId(@NonNull Context context) { PackageInfo packageInfo = getPackageInfo(context); return packageInfo != null ? packageInfo.packageName : null; } } | Utils { @Nullable public static String getAppId(@NonNull Context context) { PackageInfo packageInfo = getPackageInfo(context); return packageInfo != null ? packageInfo.packageName : null; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { @Nullable public static String getAppId(@NonNull Context context) { PackageInfo packageInfo = getPackageInfo(context); return packageInfo != null ? packageInfo.packageName : null; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void testGetAppVersionShouldReturnAppVersion() { assertNull(Utils.getAppVersion(RuntimeEnvironment.application)); } | @Nullable public static String getAppVersion(@NonNull Context context) { PackageInfo packageInfo = getPackageInfo(context); return packageInfo != null ? packageInfo.versionName : null; } | Utils { @Nullable public static String getAppVersion(@NonNull Context context) { PackageInfo packageInfo = getPackageInfo(context); return packageInfo != null ? packageInfo.versionName : null; } } | Utils { @Nullable public static String getAppVersion(@NonNull Context context) { PackageInfo packageInfo = getPackageInfo(context); return packageInfo != null ? packageInfo.versionName : null; } } | Utils { @Nullable public static String getAppVersion(@NonNull Context context) { PackageInfo packageInfo = getPackageInfo(context); return packageInfo != null ? packageInfo.versionName : null; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); } | Utils { @Nullable public static String getAppVersion(@NonNull Context context) { PackageInfo packageInfo = getPackageInfo(context); return packageInfo != null ? packageInfo.versionName : null; } static String convertDateFormat(String date, boolean suppressException); static Date toDate(String date, boolean suppressException); static String convertDateFormat(String date, String defaultV, boolean suppressException); static String convertDateFormat(DateTime date); static String convertDateTimeFormat(String date, boolean suppressException); static void fillValue(TextView v, Map<String, String> cm, String field, boolean humanize); static void fillValue(TextView v, Map<String, String> cm, String field, String defaultV, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, boolean humanize); static void fillValue(TextView v, CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static void addToList(Map<String, String> locations, Map<String, TreeNode<String, Location>> locationMap,
String locationTag); static void fillValue(TextView v, String value); static String formatValue(String value, boolean humanize); static String formatValue(Object value, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, boolean humanize); static String getValue(CommonPersonObjectClient pc, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, String defaultV, boolean humanize); static String getValue(Map<String, String> cm, String field, boolean humanize); static String nonEmptyValue(Map<String, String> cm, boolean asc, boolean humanize, String... fields); static boolean hasAnyEmptyValue(Map<String, String> cm, String postFix, String... fields); static int addAsInts(boolean ignoreEmpty, String... vals); static TableRow addToRow(Context context, String value, TableRow row); static TableRow addToRow(Context context, String value, TableRow row, int weight); static TableRow addToRow(Context context, String value, TableRow row, boolean compact); static TableRow addToRow(Context context, String value, TableRow row, boolean compact, int weight); static TableRow addToRow(Context context, Spanned value, TableRow row, boolean compact, int weight); static Gson getLongDateAwareGson(); static boolean isConnectedToNetwork(Context context); static boolean hasFroyo(); static boolean hasGingerbread(); static boolean hasHoneycomb(); static boolean hasHoneycombMR1(); static boolean hasJellyBean(); static String getName(@NonNull String firstName, @NonNull String lastName); static String readAssetContents(Context context, String path); static InputStream getAssetFileInputStream(Context context, String path); @TargetApi(VERSION_CODES.HONEYCOMB) static void startAsyncTask(AsyncTask<T, ?, ?> asyncTask, T[] params); static DateTime dobToDateTime(CommonPersonObjectClient childDetails); static List<Map<String, String>> populateTableFromCSV(Context context, String csvFileName,
Map<Integer, String> columns); static String kgStringSuffix(Float weight); static String kgStringSuffix(String weight); static String cmStringSuffix(Float height); static String cmStringSuffix(String height); static CommonPersonObjectClient convert(CommonPersonObject commonPersonObject); static boolean getBooleanProperty(String key); static void showToast(Context context, String message); static void showShortToast(Context context, String message); static void showToastCore(Context context, String message, int duration); static void hideKeyboard(Context context, View view); static void hideKeyboard(Activity activity); static boolean isEmptyCollection(Collection collection); static boolean isEmptyMap(Map map); static String getVersion(Context context); static long getVersionCode(Context context); static String getBuildDate(Boolean isShortMonth); static String getUserDefaultTeamId(LoginResponseData userInfo); static String getPrefferedName(); String getName(); static String getUserInitials(); static AllSharedPreferences getAllSharedPreferences(); static String getDuration(String date); static String getDob(int age); static String getDob(int age, String dateFormatPattern); static int getAgeFromDate(String dateOfBirth); static Date dobStringToDate(String dobString); static DateTime dobStringToDateTime(String dobString); static Intent completeSync(FetchStatus fetchStatus); static boolean is2xxSuccessful(int httpStatus); static String getFilterValue(LoginResponse loginResponse, SyncFilter syncFilterParam); static AppProperties getProperties(Context context); static String getTranslatedIdentifier(String key); static void copyDatabase(String dbName, String copyDbName, Context context); static Locale getDefaultLocale(); static boolean deleteRoomDb(@NonNull Context context, @NonNull String databaseName); @Nullable static String getAppId(@NonNull Context context); @Nullable static String getAppVersion(@NonNull Context context); static Long tryParseLong(String value, long defaultValue); static int calculatePercentage(long totalCount, long partialCount); static AccountAuthenticatorXml parseAuthenticatorXMLConfigData(Context context); static void logoutUser(org.smartregister.Context context, String message); static final String APP_PROPERTIES_FILE; } |
@Test public void testUserService() { UserService userService = context.userService(); Assert.assertNotNull(userService); } | public UserService userService() { if (userService == null) { userService = new UserService(allSettings(), allSharedPreferences(), httpAgent(), session(), configuration(), saveANMLocationTask(), saveUserInfoTask(), saveANMTeamTask()); } return userService; } | Context { public UserService userService() { if (userService == null) { userService = new UserService(allSettings(), allSharedPreferences(), httpAgent(), session(), configuration(), saveANMLocationTask(), saveUserInfoTask(), saveANMTeamTask()); } return userService; } } | Context { public UserService userService() { if (userService == null) { userService = new UserService(allSettings(), allSharedPreferences(), httpAgent(), session(), configuration(), saveANMLocationTask(), saveUserInfoTask(), saveANMTeamTask()); } return userService; } protected Context(); } | Context { public UserService userService() { if (userService == null) { userService = new UserService(allSettings(), allSharedPreferences(), httpAgent(), session(), configuration(), saveANMLocationTask(), saveUserInfoTask(), saveANMTeamTask()); } return userService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public UserService userService() { if (userService == null) { userService = new UserService(allSettings(), allSharedPreferences(), httpAgent(), session(), configuration(), saveANMLocationTask(), saveUserInfoTask(), saveANMTeamTask()); } return userService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testImageRepository() { ImageRepository imageRepository = context.imageRepository(); Assert.assertNotNull(imageRepository); } | public ImageRepository imageRepository() { if (imageRepository == null) { imageRepository = new ImageRepository(); } return imageRepository; } | Context { public ImageRepository imageRepository() { if (imageRepository == null) { imageRepository = new ImageRepository(); } return imageRepository; } } | Context { public ImageRepository imageRepository() { if (imageRepository == null) { imageRepository = new ImageRepository(); } return imageRepository; } protected Context(); } | Context { public ImageRepository imageRepository() { if (imageRepository == null) { imageRepository = new ImageRepository(); } return imageRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public ImageRepository imageRepository() { if (imageRepository == null) { imageRepository = new ImageRepository(); } return imageRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testGetDisplayWidthReturnsCorrectWidthPixelsValue() { Mockito.doReturn(resources).when(context).getResources(); Mockito.doReturn(windowManager).when(context).getWindowManager(); DisplayManager displayManager = (DisplayManager) RuntimeEnvironment.application.getSystemService(Context.DISPLAY_SERVICE); Display display = displayManager.getDisplays()[0]; Mockito.doReturn(display).when(windowManager).getDefaultDisplay(); int defaultMetrics = display.getWidth(); int displayWidth = DisplayUtils.getDisplayWidth(context); Assert.assertTrue(displayWidth > 0); Assert.assertEquals(defaultMetrics, displayWidth); } | public static int getDisplayWidth(Activity activity) { DisplayMetrics displayMetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); return displayMetrics.widthPixels; } | DisplayUtils { public static int getDisplayWidth(Activity activity) { DisplayMetrics displayMetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); return displayMetrics.widthPixels; } } | DisplayUtils { public static int getDisplayWidth(Activity activity) { DisplayMetrics displayMetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); return displayMetrics.widthPixels; } } | DisplayUtils { public static int getDisplayWidth(Activity activity) { DisplayMetrics displayMetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); return displayMetrics.widthPixels; } static ScreenDpi getScreenDpi(Context context); static int getDisplayWidth(Activity activity); static int getDisplayHeight(Activity activity); static double getScreenSize(Activity activity); } | DisplayUtils { public static int getDisplayWidth(Activity activity) { DisplayMetrics displayMetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); return displayMetrics.widthPixels; } static ScreenDpi getScreenDpi(Context context); static int getDisplayWidth(Activity activity); static int getDisplayHeight(Activity activity); static double getScreenSize(Activity activity); } |
@Test public void testAllAlerts() { AllAlerts allAlerts = context.allAlerts(); Assert.assertNotNull(allAlerts); } | public AllAlerts allAlerts() { if (allAlerts == null) { allAlerts = new AllAlerts(alertRepository()); } return allAlerts; } | Context { public AllAlerts allAlerts() { if (allAlerts == null) { allAlerts = new AllAlerts(alertRepository()); } return allAlerts; } } | Context { public AllAlerts allAlerts() { if (allAlerts == null) { allAlerts = new AllAlerts(alertRepository()); } return allAlerts; } protected Context(); } | Context { public AllAlerts allAlerts() { if (allAlerts == null) { allAlerts = new AllAlerts(alertRepository()); } return allAlerts; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public AllAlerts allAlerts() { if (allAlerts == null) { allAlerts = new AllAlerts(alertRepository()); } return allAlerts; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testHttpAgent() { HTTPAgent httpAgent = context.httpAgent(); Assert.assertNotNull(httpAgent); } | public HTTPAgent httpAgent() { if (httpAgent == null) { httpAgent = new HTTPAgent(applicationContext, allSharedPreferences(), configuration()); } return httpAgent; } | Context { public HTTPAgent httpAgent() { if (httpAgent == null) { httpAgent = new HTTPAgent(applicationContext, allSharedPreferences(), configuration()); } return httpAgent; } } | Context { public HTTPAgent httpAgent() { if (httpAgent == null) { httpAgent = new HTTPAgent(applicationContext, allSharedPreferences(), configuration()); } return httpAgent; } protected Context(); } | Context { public HTTPAgent httpAgent() { if (httpAgent == null) { httpAgent = new HTTPAgent(applicationContext, allSharedPreferences(), configuration()); } return httpAgent; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public HTTPAgent httpAgent() { if (httpAgent == null) { httpAgent = new HTTPAgent(applicationContext, allSharedPreferences(), configuration()); } return httpAgent; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testAnmService() { ANMService anmService = context.anmService(); Assert.assertNotNull(anmService); } | public ANMService anmService() { if (anmService == null) { anmService = new ANMService(allSharedPreferences(), allBeneficiaries(), allEligibleCouples()); } return anmService; } | Context { public ANMService anmService() { if (anmService == null) { anmService = new ANMService(allSharedPreferences(), allBeneficiaries(), allEligibleCouples()); } return anmService; } } | Context { public ANMService anmService() { if (anmService == null) { anmService = new ANMService(allSharedPreferences(), allBeneficiaries(), allEligibleCouples()); } return anmService; } protected Context(); } | Context { public ANMService anmService() { if (anmService == null) { anmService = new ANMService(allSharedPreferences(), allBeneficiaries(), allEligibleCouples()); } return anmService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public ANMService anmService() { if (anmService == null) { anmService = new ANMService(allSharedPreferences(), allBeneficiaries(), allEligibleCouples()); } return anmService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testConfiguration() { DristhiConfiguration dristhiConfiguration = context.configuration(); Assert.assertNotNull(dristhiConfiguration); } | public DristhiConfiguration configuration() { if (configuration == null) { configuration = new DristhiConfiguration(); } return configuration; } | Context { public DristhiConfiguration configuration() { if (configuration == null) { configuration = new DristhiConfiguration(); } return configuration; } } | Context { public DristhiConfiguration configuration() { if (configuration == null) { configuration = new DristhiConfiguration(); } return configuration; } protected Context(); } | Context { public DristhiConfiguration configuration() { if (configuration == null) { configuration = new DristhiConfiguration(); } return configuration; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public DristhiConfiguration configuration() { if (configuration == null) { configuration = new DristhiConfiguration(); } return configuration; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testAnmController() { ANMController anmController = context.anmController(); Assert.assertNotNull(anmController); } | public ANMController anmController() { if (anmController == null) { anmController = new ANMController(anmService(), listCache(), homeContextCache()); } return anmController; } | Context { public ANMController anmController() { if (anmController == null) { anmController = new ANMController(anmService(), listCache(), homeContextCache()); } return anmController; } } | Context { public ANMController anmController() { if (anmController == null) { anmController = new ANMController(anmService(), listCache(), homeContextCache()); } return anmController; } protected Context(); } | Context { public ANMController anmController() { if (anmController == null) { anmController = new ANMController(anmService(), listCache(), homeContextCache()); } return anmController; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public ANMController anmController() { if (anmController == null) { anmController = new ANMController(anmService(), listCache(), homeContextCache()); } return anmController; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testAnmLocationController() { ANMLocationController anmLocationController = context.anmLocationController(); Assert.assertNotNull(anmLocationController); } | public ANMLocationController anmLocationController() { if (anmLocationController == null) { anmLocationController = new ANMLocationController(allSettings(), listCache()); } return anmLocationController; } | Context { public ANMLocationController anmLocationController() { if (anmLocationController == null) { anmLocationController = new ANMLocationController(allSettings(), listCache()); } return anmLocationController; } } | Context { public ANMLocationController anmLocationController() { if (anmLocationController == null) { anmLocationController = new ANMLocationController(allSettings(), listCache()); } return anmLocationController; } protected Context(); } | Context { public ANMLocationController anmLocationController() { if (anmLocationController == null) { anmLocationController = new ANMLocationController(allSettings(), listCache()); } return anmLocationController; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public ANMLocationController anmLocationController() { if (anmLocationController == null) { anmLocationController = new ANMLocationController(allSettings(), listCache()); } return anmLocationController; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testGetHttpAgent() { HTTPAgent httpAgent = context.getHttpAgent(); Assert.assertNotNull(httpAgent); } | public HTTPAgent getHttpAgent() { return httpAgent(); } | Context { public HTTPAgent getHttpAgent() { return httpAgent(); } } | Context { public HTTPAgent getHttpAgent() { return httpAgent(); } protected Context(); } | Context { public HTTPAgent getHttpAgent() { return httpAgent(); } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public HTTPAgent getHttpAgent() { return httpAgent(); } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testGetEventClientRepository() { EventClientRepository eventClientRepository = context.getEventClientRepository(); Assert.assertNotNull(eventClientRepository); } | public EventClientRepository getEventClientRepository() { if (eventClientRepository == null) { eventClientRepository = new EventClientRepository(); } return eventClientRepository; } | Context { public EventClientRepository getEventClientRepository() { if (eventClientRepository == null) { eventClientRepository = new EventClientRepository(); } return eventClientRepository; } } | Context { public EventClientRepository getEventClientRepository() { if (eventClientRepository == null) { eventClientRepository = new EventClientRepository(); } return eventClientRepository; } protected Context(); } | Context { public EventClientRepository getEventClientRepository() { if (eventClientRepository == null) { eventClientRepository = new EventClientRepository(); } return eventClientRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public EventClientRepository getEventClientRepository() { if (eventClientRepository == null) { eventClientRepository = new EventClientRepository(); } return eventClientRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testGetUniqueIdRepository() { UniqueIdRepository uniqueIdRepository = context.getUniqueIdRepository(); Assert.assertNotNull(uniqueIdRepository); } | public UniqueIdRepository getUniqueIdRepository() { if (uniqueIdRepository == null) { uniqueIdRepository = new UniqueIdRepository(); } return uniqueIdRepository; } | Context { public UniqueIdRepository getUniqueIdRepository() { if (uniqueIdRepository == null) { uniqueIdRepository = new UniqueIdRepository(); } return uniqueIdRepository; } } | Context { public UniqueIdRepository getUniqueIdRepository() { if (uniqueIdRepository == null) { uniqueIdRepository = new UniqueIdRepository(); } return uniqueIdRepository; } protected Context(); } | Context { public UniqueIdRepository getUniqueIdRepository() { if (uniqueIdRepository == null) { uniqueIdRepository = new UniqueIdRepository(); } return uniqueIdRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public UniqueIdRepository getUniqueIdRepository() { if (uniqueIdRepository == null) { uniqueIdRepository = new UniqueIdRepository(); } return uniqueIdRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testGetCampaignRepository() { CampaignRepository campaignRepository = context.getCampaignRepository(); Assert.assertNotNull(campaignRepository); } | public CampaignRepository getCampaignRepository() { if (campaignRepository == null) { campaignRepository = new CampaignRepository(); } return campaignRepository; } | Context { public CampaignRepository getCampaignRepository() { if (campaignRepository == null) { campaignRepository = new CampaignRepository(); } return campaignRepository; } } | Context { public CampaignRepository getCampaignRepository() { if (campaignRepository == null) { campaignRepository = new CampaignRepository(); } return campaignRepository; } protected Context(); } | Context { public CampaignRepository getCampaignRepository() { if (campaignRepository == null) { campaignRepository = new CampaignRepository(); } return campaignRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public CampaignRepository getCampaignRepository() { if (campaignRepository == null) { campaignRepository = new CampaignRepository(); } return campaignRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testGetDisplayHeightReturnsCorrectHeightPixelsValue() { Mockito.doReturn(resources).when(context).getResources(); Mockito.doReturn(windowManager).when(context).getWindowManager(); DisplayManager displayManager = (DisplayManager) RuntimeEnvironment.application.getSystemService(Context.DISPLAY_SERVICE); Display display = displayManager.getDisplays()[0]; Mockito.doReturn(display).when(windowManager).getDefaultDisplay(); int defaultMetrics = display.getHeight(); int displayHeight = DisplayUtils.getDisplayHeight(context); Assert.assertTrue(displayHeight > 0); Assert.assertEquals(defaultMetrics, displayHeight); } | public static int getDisplayHeight(Activity activity) { DisplayMetrics displayMetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); return displayMetrics.heightPixels; } | DisplayUtils { public static int getDisplayHeight(Activity activity) { DisplayMetrics displayMetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); return displayMetrics.heightPixels; } } | DisplayUtils { public static int getDisplayHeight(Activity activity) { DisplayMetrics displayMetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); return displayMetrics.heightPixels; } } | DisplayUtils { public static int getDisplayHeight(Activity activity) { DisplayMetrics displayMetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); return displayMetrics.heightPixels; } static ScreenDpi getScreenDpi(Context context); static int getDisplayWidth(Activity activity); static int getDisplayHeight(Activity activity); static double getScreenSize(Activity activity); } | DisplayUtils { public static int getDisplayHeight(Activity activity) { DisplayMetrics displayMetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); return displayMetrics.heightPixels; } static ScreenDpi getScreenDpi(Context context); static int getDisplayWidth(Activity activity); static int getDisplayHeight(Activity activity); static double getScreenSize(Activity activity); } |
@Test public void testgetTaskRepository() { TaskRepository taskRepository = context.getTaskRepository(); Assert.assertNotNull(taskRepository); } | public TaskRepository getTaskRepository() { if (taskRepository == null) { taskNotesRepository = new TaskNotesRepository(); taskRepository = new TaskRepository(taskNotesRepository); } return taskRepository; } | Context { public TaskRepository getTaskRepository() { if (taskRepository == null) { taskNotesRepository = new TaskNotesRepository(); taskRepository = new TaskRepository(taskNotesRepository); } return taskRepository; } } | Context { public TaskRepository getTaskRepository() { if (taskRepository == null) { taskNotesRepository = new TaskNotesRepository(); taskRepository = new TaskRepository(taskNotesRepository); } return taskRepository; } protected Context(); } | Context { public TaskRepository getTaskRepository() { if (taskRepository == null) { taskNotesRepository = new TaskNotesRepository(); taskRepository = new TaskRepository(taskNotesRepository); } return taskRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public TaskRepository getTaskRepository() { if (taskRepository == null) { taskNotesRepository = new TaskNotesRepository(); taskRepository = new TaskRepository(taskNotesRepository); } return taskRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testBeneficiaryService() { BeneficiaryService beneficiaryService = context.beneficiaryService(); Assert.assertNotNull(beneficiaryService); } | public BeneficiaryService beneficiaryService() { if (beneficiaryService == null) { beneficiaryService = new BeneficiaryService(allEligibleCouples(), allBeneficiaries()); } return beneficiaryService; } | Context { public BeneficiaryService beneficiaryService() { if (beneficiaryService == null) { beneficiaryService = new BeneficiaryService(allEligibleCouples(), allBeneficiaries()); } return beneficiaryService; } } | Context { public BeneficiaryService beneficiaryService() { if (beneficiaryService == null) { beneficiaryService = new BeneficiaryService(allEligibleCouples(), allBeneficiaries()); } return beneficiaryService; } protected Context(); } | Context { public BeneficiaryService beneficiaryService() { if (beneficiaryService == null) { beneficiaryService = new BeneficiaryService(allEligibleCouples(), allBeneficiaries()); } return beneficiaryService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public BeneficiaryService beneficiaryService() { if (beneficiaryService == null) { beneficiaryService = new BeneficiaryService(allEligibleCouples(), allBeneficiaries()); } return beneficiaryService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testDrishtiService() { DrishtiService drishtiService = context.drishtiService(); Assert.assertNotNull(drishtiService); } | protected DrishtiService drishtiService() { if (drishtiService == null) { drishtiService = new DrishtiService(httpAgent(), configuration().dristhiBaseURL()); } return drishtiService; } | Context { protected DrishtiService drishtiService() { if (drishtiService == null) { drishtiService = new DrishtiService(httpAgent(), configuration().dristhiBaseURL()); } return drishtiService; } } | Context { protected DrishtiService drishtiService() { if (drishtiService == null) { drishtiService = new DrishtiService(httpAgent(), configuration().dristhiBaseURL()); } return drishtiService; } protected Context(); } | Context { protected DrishtiService drishtiService() { if (drishtiService == null) { drishtiService = new DrishtiService(httpAgent(), configuration().dristhiBaseURL()); } return drishtiService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { protected DrishtiService drishtiService() { if (drishtiService == null) { drishtiService = new DrishtiService(httpAgent(), configuration().dristhiBaseURL()); } return drishtiService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testActionService() { ActionService actionService = context.actionService(); Assert.assertNotNull(actionService); } | public ActionService actionService() { if (actionService == null) { actionService = new ActionService(drishtiService(), allSettings(), allSharedPreferences(), allReports()); } return actionService; } | Context { public ActionService actionService() { if (actionService == null) { actionService = new ActionService(drishtiService(), allSettings(), allSharedPreferences(), allReports()); } return actionService; } } | Context { public ActionService actionService() { if (actionService == null) { actionService = new ActionService(drishtiService(), allSettings(), allSharedPreferences(), allReports()); } return actionService; } protected Context(); } | Context { public ActionService actionService() { if (actionService == null) { actionService = new ActionService(drishtiService(), allSettings(), allSharedPreferences(), allReports()); } return actionService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public ActionService actionService() { if (actionService == null) { actionService = new ActionService(drishtiService(), allSettings(), allSharedPreferences(), allReports()); } return actionService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testFormSubmissionService() { context.assignbindtypes(); FormSubmissionService formSubmissionService = context.formSubmissionService(); Assert.assertNotNull(formSubmissionService); } | public FormSubmissionService formSubmissionService() { if (formSubmissionService == null) { if (commonFtsObject != null) { formSubmissionService = new FormSubmissionService(ziggyService(), formDataRepository(), allSettings(), allCommonsRepositoryMap()); } else { formSubmissionService = new FormSubmissionService(ziggyService(), formDataRepository(), allSettings()); } } return formSubmissionService; } | Context { public FormSubmissionService formSubmissionService() { if (formSubmissionService == null) { if (commonFtsObject != null) { formSubmissionService = new FormSubmissionService(ziggyService(), formDataRepository(), allSettings(), allCommonsRepositoryMap()); } else { formSubmissionService = new FormSubmissionService(ziggyService(), formDataRepository(), allSettings()); } } return formSubmissionService; } } | Context { public FormSubmissionService formSubmissionService() { if (formSubmissionService == null) { if (commonFtsObject != null) { formSubmissionService = new FormSubmissionService(ziggyService(), formDataRepository(), allSettings(), allCommonsRepositoryMap()); } else { formSubmissionService = new FormSubmissionService(ziggyService(), formDataRepository(), allSettings()); } } return formSubmissionService; } protected Context(); } | Context { public FormSubmissionService formSubmissionService() { if (formSubmissionService == null) { if (commonFtsObject != null) { formSubmissionService = new FormSubmissionService(ziggyService(), formDataRepository(), allSettings(), allCommonsRepositoryMap()); } else { formSubmissionService = new FormSubmissionService(ziggyService(), formDataRepository(), allSettings()); } } return formSubmissionService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public FormSubmissionService formSubmissionService() { if (formSubmissionService == null) { if (commonFtsObject != null) { formSubmissionService = new FormSubmissionService(ziggyService(), formDataRepository(), allSettings(), allCommonsRepositoryMap()); } else { formSubmissionService = new FormSubmissionService(ziggyService(), formDataRepository(), allSettings()); } } return formSubmissionService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testAllFormVersionSyncService() { AllFormVersionSyncService allFormVersionSyncService = context.allFormVersionSyncService(); Assert.assertNotNull(allFormVersionSyncService); } | public AllFormVersionSyncService allFormVersionSyncService() { if (allFormVersionSyncService == null) { allFormVersionSyncService = new AllFormVersionSyncService(httpAgent(), configuration(), formsVersionRepository()); } return allFormVersionSyncService; } | Context { public AllFormVersionSyncService allFormVersionSyncService() { if (allFormVersionSyncService == null) { allFormVersionSyncService = new AllFormVersionSyncService(httpAgent(), configuration(), formsVersionRepository()); } return allFormVersionSyncService; } } | Context { public AllFormVersionSyncService allFormVersionSyncService() { if (allFormVersionSyncService == null) { allFormVersionSyncService = new AllFormVersionSyncService(httpAgent(), configuration(), formsVersionRepository()); } return allFormVersionSyncService; } protected Context(); } | Context { public AllFormVersionSyncService allFormVersionSyncService() { if (allFormVersionSyncService == null) { allFormVersionSyncService = new AllFormVersionSyncService(httpAgent(), configuration(), formsVersionRepository()); } return allFormVersionSyncService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public AllFormVersionSyncService allFormVersionSyncService() { if (allFormVersionSyncService == null) { allFormVersionSyncService = new AllFormVersionSyncService(httpAgent(), configuration(), formsVersionRepository()); } return allFormVersionSyncService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testFormSubmissionRouter() { FormSubmissionRouter formSubmissionRouter = context.formSubmissionRouter(); Assert.assertNotNull(formSubmissionRouter); } | public FormSubmissionRouter formSubmissionRouter() { if (formSubmissionRouter == null) { formSubmissionRouter = new FormSubmissionRouter(formDataRepository(), ecRegistrationHandler(), fpComplicationsHandler(), fpChangeHandler(), renewFPProductHandler(), ecCloseHandler(), ancRegistrationHandler(), ancRegistrationOAHandler(), ancVisitHandler(), ancCloseHandler(), ttHandler(), ifaHandler(), hbTestHandler(), deliveryOutcomeHandler(), pncRegistrationOAHandler(), pncCloseHandler(), pncVisitHandler(), childImmunizationsHandler(), childRegistrationECHandler(), childRegistrationOAHandler(), childCloseHandler(), childIllnessHandler(), vitaminAHandler(), deliveryPlanHandler(), ecEditHandler(), ancInvestigationsHandler()); } return formSubmissionRouter; } | Context { public FormSubmissionRouter formSubmissionRouter() { if (formSubmissionRouter == null) { formSubmissionRouter = new FormSubmissionRouter(formDataRepository(), ecRegistrationHandler(), fpComplicationsHandler(), fpChangeHandler(), renewFPProductHandler(), ecCloseHandler(), ancRegistrationHandler(), ancRegistrationOAHandler(), ancVisitHandler(), ancCloseHandler(), ttHandler(), ifaHandler(), hbTestHandler(), deliveryOutcomeHandler(), pncRegistrationOAHandler(), pncCloseHandler(), pncVisitHandler(), childImmunizationsHandler(), childRegistrationECHandler(), childRegistrationOAHandler(), childCloseHandler(), childIllnessHandler(), vitaminAHandler(), deliveryPlanHandler(), ecEditHandler(), ancInvestigationsHandler()); } return formSubmissionRouter; } } | Context { public FormSubmissionRouter formSubmissionRouter() { if (formSubmissionRouter == null) { formSubmissionRouter = new FormSubmissionRouter(formDataRepository(), ecRegistrationHandler(), fpComplicationsHandler(), fpChangeHandler(), renewFPProductHandler(), ecCloseHandler(), ancRegistrationHandler(), ancRegistrationOAHandler(), ancVisitHandler(), ancCloseHandler(), ttHandler(), ifaHandler(), hbTestHandler(), deliveryOutcomeHandler(), pncRegistrationOAHandler(), pncCloseHandler(), pncVisitHandler(), childImmunizationsHandler(), childRegistrationECHandler(), childRegistrationOAHandler(), childCloseHandler(), childIllnessHandler(), vitaminAHandler(), deliveryPlanHandler(), ecEditHandler(), ancInvestigationsHandler()); } return formSubmissionRouter; } protected Context(); } | Context { public FormSubmissionRouter formSubmissionRouter() { if (formSubmissionRouter == null) { formSubmissionRouter = new FormSubmissionRouter(formDataRepository(), ecRegistrationHandler(), fpComplicationsHandler(), fpChangeHandler(), renewFPProductHandler(), ecCloseHandler(), ancRegistrationHandler(), ancRegistrationOAHandler(), ancVisitHandler(), ancCloseHandler(), ttHandler(), ifaHandler(), hbTestHandler(), deliveryOutcomeHandler(), pncRegistrationOAHandler(), pncCloseHandler(), pncVisitHandler(), childImmunizationsHandler(), childRegistrationECHandler(), childRegistrationOAHandler(), childCloseHandler(), childIllnessHandler(), vitaminAHandler(), deliveryPlanHandler(), ecEditHandler(), ancInvestigationsHandler()); } return formSubmissionRouter; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public FormSubmissionRouter formSubmissionRouter() { if (formSubmissionRouter == null) { formSubmissionRouter = new FormSubmissionRouter(formDataRepository(), ecRegistrationHandler(), fpComplicationsHandler(), fpChangeHandler(), renewFPProductHandler(), ecCloseHandler(), ancRegistrationHandler(), ancRegistrationOAHandler(), ancVisitHandler(), ancCloseHandler(), ttHandler(), ifaHandler(), hbTestHandler(), deliveryOutcomeHandler(), pncRegistrationOAHandler(), pncCloseHandler(), pncVisitHandler(), childImmunizationsHandler(), childRegistrationECHandler(), childRegistrationOAHandler(), childCloseHandler(), childIllnessHandler(), vitaminAHandler(), deliveryPlanHandler(), ecEditHandler(), ancInvestigationsHandler()); } return formSubmissionRouter; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testZiggyService() { context.assignbindtypes(); ZiggyService ziggyService = context.ziggyService(); Assert.assertNotNull(ziggyService); } | public ZiggyService ziggyService() { if (ziggyService == null) { ziggyService = new ZiggyService(ziggyFileLoader(), formDataRepository(), formSubmissionRouter()); } return ziggyService; } | Context { public ZiggyService ziggyService() { if (ziggyService == null) { ziggyService = new ZiggyService(ziggyFileLoader(), formDataRepository(), formSubmissionRouter()); } return ziggyService; } } | Context { public ZiggyService ziggyService() { if (ziggyService == null) { ziggyService = new ZiggyService(ziggyFileLoader(), formDataRepository(), formSubmissionRouter()); } return ziggyService; } protected Context(); } | Context { public ZiggyService ziggyService() { if (ziggyService == null) { ziggyService = new ZiggyService(ziggyFileLoader(), formDataRepository(), formSubmissionRouter()); } return ziggyService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public ZiggyService ziggyService() { if (ziggyService == null) { ziggyService = new ZiggyService(ziggyFileLoader(), formDataRepository(), formSubmissionRouter()); } return ziggyService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testZiggyFileLoader() { ZiggyFileLoader ziggyFileLoader = context.ziggyFileLoader(); Assert.assertNotNull(ziggyFileLoader); } | public ZiggyFileLoader ziggyFileLoader() { if (ziggyFileLoader == null) { ziggyFileLoader = new ZiggyFileLoader("www/ziggy", "www/form", applicationContext().getAssets()); } return ziggyFileLoader; } | Context { public ZiggyFileLoader ziggyFileLoader() { if (ziggyFileLoader == null) { ziggyFileLoader = new ZiggyFileLoader("www/ziggy", "www/form", applicationContext().getAssets()); } return ziggyFileLoader; } } | Context { public ZiggyFileLoader ziggyFileLoader() { if (ziggyFileLoader == null) { ziggyFileLoader = new ZiggyFileLoader("www/ziggy", "www/form", applicationContext().getAssets()); } return ziggyFileLoader; } protected Context(); } | Context { public ZiggyFileLoader ziggyFileLoader() { if (ziggyFileLoader == null) { ziggyFileLoader = new ZiggyFileLoader("www/ziggy", "www/form", applicationContext().getAssets()); } return ziggyFileLoader; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public ZiggyFileLoader ziggyFileLoader() { if (ziggyFileLoader == null) { ziggyFileLoader = new ZiggyFileLoader("www/ziggy", "www/form", applicationContext().getAssets()); } return ziggyFileLoader; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testFormSubmissionSyncService() { FormSubmissionSyncService formSubmissionSyncService = context.formSubmissionSyncService(); Assert.assertNotNull(formSubmissionSyncService); } | public FormSubmissionSyncService formSubmissionSyncService() { if (formSubmissionSyncService == null) { formSubmissionSyncService = new FormSubmissionSyncService(formSubmissionService(), httpAgent(), formDataRepository(), allSettings(), allSharedPreferences(), configuration()); } return formSubmissionSyncService; } | Context { public FormSubmissionSyncService formSubmissionSyncService() { if (formSubmissionSyncService == null) { formSubmissionSyncService = new FormSubmissionSyncService(formSubmissionService(), httpAgent(), formDataRepository(), allSettings(), allSharedPreferences(), configuration()); } return formSubmissionSyncService; } } | Context { public FormSubmissionSyncService formSubmissionSyncService() { if (formSubmissionSyncService == null) { formSubmissionSyncService = new FormSubmissionSyncService(formSubmissionService(), httpAgent(), formDataRepository(), allSettings(), allSharedPreferences(), configuration()); } return formSubmissionSyncService; } protected Context(); } | Context { public FormSubmissionSyncService formSubmissionSyncService() { if (formSubmissionSyncService == null) { formSubmissionSyncService = new FormSubmissionSyncService(formSubmissionService(), httpAgent(), formDataRepository(), allSettings(), allSharedPreferences(), configuration()); } return formSubmissionSyncService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public FormSubmissionSyncService formSubmissionSyncService() { if (formSubmissionSyncService == null) { formSubmissionSyncService = new FormSubmissionSyncService(formSubmissionService(), httpAgent(), formDataRepository(), allSettings(), allSharedPreferences(), configuration()); } return formSubmissionSyncService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testGetScreenSizeReturnsCorrectValues() { Mockito.doReturn(resources).when(context).getResources(); Mockito.doReturn(windowManager).when(context).getWindowManager(); DisplayManager displayManager = (DisplayManager) RuntimeEnvironment.application.getSystemService(Context.DISPLAY_SERVICE); Display display = displayManager.getDisplays()[0]; Mockito.doReturn(display).when(windowManager).getDefaultDisplay(); double screenSize = DisplayUtils.getScreenSize(context); Assert.assertEquals(3.5, screenSize, 0.1); } | public static double getScreenSize(Activity activity) { DisplayMetrics dm = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(dm); int width = dm.widthPixels; int height = dm.heightPixels; double wi = (double) width / (double) dm.xdpi; double hi = (double) height / (double) dm.ydpi; double x = Math.pow(wi, 2); double y = Math.pow(hi, 2); return Math.sqrt(x + y); } | DisplayUtils { public static double getScreenSize(Activity activity) { DisplayMetrics dm = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(dm); int width = dm.widthPixels; int height = dm.heightPixels; double wi = (double) width / (double) dm.xdpi; double hi = (double) height / (double) dm.ydpi; double x = Math.pow(wi, 2); double y = Math.pow(hi, 2); return Math.sqrt(x + y); } } | DisplayUtils { public static double getScreenSize(Activity activity) { DisplayMetrics dm = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(dm); int width = dm.widthPixels; int height = dm.heightPixels; double wi = (double) width / (double) dm.xdpi; double hi = (double) height / (double) dm.ydpi; double x = Math.pow(wi, 2); double y = Math.pow(hi, 2); return Math.sqrt(x + y); } } | DisplayUtils { public static double getScreenSize(Activity activity) { DisplayMetrics dm = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(dm); int width = dm.widthPixels; int height = dm.heightPixels; double wi = (double) width / (double) dm.xdpi; double hi = (double) height / (double) dm.ydpi; double x = Math.pow(wi, 2); double y = Math.pow(hi, 2); return Math.sqrt(x + y); } static ScreenDpi getScreenDpi(Context context); static int getDisplayWidth(Activity activity); static int getDisplayHeight(Activity activity); static double getScreenSize(Activity activity); } | DisplayUtils { public static double getScreenSize(Activity activity) { DisplayMetrics dm = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(dm); int width = dm.widthPixels; int height = dm.heightPixels; double wi = (double) width / (double) dm.xdpi; double hi = (double) height / (double) dm.ydpi; double x = Math.pow(wi, 2); double y = Math.pow(hi, 2); return Math.sqrt(x + y); } static ScreenDpi getScreenDpi(Context context); static int getDisplayWidth(Activity activity); static int getDisplayHeight(Activity activity); static double getScreenSize(Activity activity); } |
@Test public void testSharedRepositories() { ArrayList<DrishtiRepository> sharedRepositories = context.sharedRepositories(); Assert.assertEquals(sharedRepositories.size(), 12); } | public ArrayList<DrishtiRepository> sharedRepositories() { assignbindtypes(); ArrayList<DrishtiRepository> drishtireposotorylist = new ArrayList<DrishtiRepository>(); drishtireposotorylist.add(settingsRepository()); drishtireposotorylist.add(alertRepository()); drishtireposotorylist.add(eligibleCoupleRepository()); drishtireposotorylist.add(childRepository()); drishtireposotorylist.add(timelineEventRepository()); drishtireposotorylist.add(motherRepository()); drishtireposotorylist.add(reportRepository()); drishtireposotorylist.add(formDataRepository()); drishtireposotorylist.add(serviceProvidedRepository()); drishtireposotorylist.add(formsVersionRepository()); drishtireposotorylist.add(imageRepository()); drishtireposotorylist.add(detailsRepository()); for (int i = 0; i < bindtypes.size(); i++) { drishtireposotorylist.add(commonrepository(bindtypes.get(i).getBindtypename())); } return drishtireposotorylist; } | Context { public ArrayList<DrishtiRepository> sharedRepositories() { assignbindtypes(); ArrayList<DrishtiRepository> drishtireposotorylist = new ArrayList<DrishtiRepository>(); drishtireposotorylist.add(settingsRepository()); drishtireposotorylist.add(alertRepository()); drishtireposotorylist.add(eligibleCoupleRepository()); drishtireposotorylist.add(childRepository()); drishtireposotorylist.add(timelineEventRepository()); drishtireposotorylist.add(motherRepository()); drishtireposotorylist.add(reportRepository()); drishtireposotorylist.add(formDataRepository()); drishtireposotorylist.add(serviceProvidedRepository()); drishtireposotorylist.add(formsVersionRepository()); drishtireposotorylist.add(imageRepository()); drishtireposotorylist.add(detailsRepository()); for (int i = 0; i < bindtypes.size(); i++) { drishtireposotorylist.add(commonrepository(bindtypes.get(i).getBindtypename())); } return drishtireposotorylist; } } | Context { public ArrayList<DrishtiRepository> sharedRepositories() { assignbindtypes(); ArrayList<DrishtiRepository> drishtireposotorylist = new ArrayList<DrishtiRepository>(); drishtireposotorylist.add(settingsRepository()); drishtireposotorylist.add(alertRepository()); drishtireposotorylist.add(eligibleCoupleRepository()); drishtireposotorylist.add(childRepository()); drishtireposotorylist.add(timelineEventRepository()); drishtireposotorylist.add(motherRepository()); drishtireposotorylist.add(reportRepository()); drishtireposotorylist.add(formDataRepository()); drishtireposotorylist.add(serviceProvidedRepository()); drishtireposotorylist.add(formsVersionRepository()); drishtireposotorylist.add(imageRepository()); drishtireposotorylist.add(detailsRepository()); for (int i = 0; i < bindtypes.size(); i++) { drishtireposotorylist.add(commonrepository(bindtypes.get(i).getBindtypename())); } return drishtireposotorylist; } protected Context(); } | Context { public ArrayList<DrishtiRepository> sharedRepositories() { assignbindtypes(); ArrayList<DrishtiRepository> drishtireposotorylist = new ArrayList<DrishtiRepository>(); drishtireposotorylist.add(settingsRepository()); drishtireposotorylist.add(alertRepository()); drishtireposotorylist.add(eligibleCoupleRepository()); drishtireposotorylist.add(childRepository()); drishtireposotorylist.add(timelineEventRepository()); drishtireposotorylist.add(motherRepository()); drishtireposotorylist.add(reportRepository()); drishtireposotorylist.add(formDataRepository()); drishtireposotorylist.add(serviceProvidedRepository()); drishtireposotorylist.add(formsVersionRepository()); drishtireposotorylist.add(imageRepository()); drishtireposotorylist.add(detailsRepository()); for (int i = 0; i < bindtypes.size(); i++) { drishtireposotorylist.add(commonrepository(bindtypes.get(i).getBindtypename())); } return drishtireposotorylist; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public ArrayList<DrishtiRepository> sharedRepositories() { assignbindtypes(); ArrayList<DrishtiRepository> drishtireposotorylist = new ArrayList<DrishtiRepository>(); drishtireposotorylist.add(settingsRepository()); drishtireposotorylist.add(alertRepository()); drishtireposotorylist.add(eligibleCoupleRepository()); drishtireposotorylist.add(childRepository()); drishtireposotorylist.add(timelineEventRepository()); drishtireposotorylist.add(motherRepository()); drishtireposotorylist.add(reportRepository()); drishtireposotorylist.add(formDataRepository()); drishtireposotorylist.add(serviceProvidedRepository()); drishtireposotorylist.add(formsVersionRepository()); drishtireposotorylist.add(imageRepository()); drishtireposotorylist.add(detailsRepository()); for (int i = 0; i < bindtypes.size(); i++) { drishtireposotorylist.add(commonrepository(bindtypes.get(i).getBindtypename())); } return drishtireposotorylist; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testSharedRepositoriesArray() { DrishtiRepository[] sharedRepositoriesArray = context.sharedRepositoriesArray(); Assert.assertEquals(sharedRepositoriesArray.length, 12); } | public DrishtiRepository[] sharedRepositoriesArray() { ArrayList<DrishtiRepository> drishtiRepositories = sharedRepositories(); DrishtiRepository[] drishtireposotoryarray = drishtiRepositories .toArray(new DrishtiRepository[drishtiRepositories.size()]); return drishtireposotoryarray; } | Context { public DrishtiRepository[] sharedRepositoriesArray() { ArrayList<DrishtiRepository> drishtiRepositories = sharedRepositories(); DrishtiRepository[] drishtireposotoryarray = drishtiRepositories .toArray(new DrishtiRepository[drishtiRepositories.size()]); return drishtireposotoryarray; } } | Context { public DrishtiRepository[] sharedRepositoriesArray() { ArrayList<DrishtiRepository> drishtiRepositories = sharedRepositories(); DrishtiRepository[] drishtireposotoryarray = drishtiRepositories .toArray(new DrishtiRepository[drishtiRepositories.size()]); return drishtireposotoryarray; } protected Context(); } | Context { public DrishtiRepository[] sharedRepositoriesArray() { ArrayList<DrishtiRepository> drishtiRepositories = sharedRepositories(); DrishtiRepository[] drishtireposotoryarray = drishtiRepositories .toArray(new DrishtiRepository[drishtiRepositories.size()]); return drishtireposotoryarray; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public DrishtiRepository[] sharedRepositoriesArray() { ArrayList<DrishtiRepository> drishtiRepositories = sharedRepositories(); DrishtiRepository[] drishtireposotoryarray = drishtiRepositories .toArray(new DrishtiRepository[drishtiRepositories.size()]); return drishtireposotoryarray; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testAllTimelineEvents() { AllTimelineEvents allTimelineEvents = context.allTimelineEvents(); Assert.assertNotNull(allTimelineEvents); } | public AllTimelineEvents allTimelineEvents() { if (allTimelineEvents == null) { allTimelineEvents = new AllTimelineEvents(timelineEventRepository()); } return allTimelineEvents; } | Context { public AllTimelineEvents allTimelineEvents() { if (allTimelineEvents == null) { allTimelineEvents = new AllTimelineEvents(timelineEventRepository()); } return allTimelineEvents; } } | Context { public AllTimelineEvents allTimelineEvents() { if (allTimelineEvents == null) { allTimelineEvents = new AllTimelineEvents(timelineEventRepository()); } return allTimelineEvents; } protected Context(); } | Context { public AllTimelineEvents allTimelineEvents() { if (allTimelineEvents == null) { allTimelineEvents = new AllTimelineEvents(timelineEventRepository()); } return allTimelineEvents; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public AllTimelineEvents allTimelineEvents() { if (allTimelineEvents == null) { allTimelineEvents = new AllTimelineEvents(timelineEventRepository()); } return allTimelineEvents; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testAllReports() { AllReports allReports = context.allReports(); Assert.assertNotNull(allReports); } | public AllReports allReports() { if (allReports == null) { allReports = new AllReports(reportRepository()); } return allReports; } | Context { public AllReports allReports() { if (allReports == null) { allReports = new AllReports(reportRepository()); } return allReports; } } | Context { public AllReports allReports() { if (allReports == null) { allReports = new AllReports(reportRepository()); } return allReports; } protected Context(); } | Context { public AllReports allReports() { if (allReports == null) { allReports = new AllReports(reportRepository()); } return allReports; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public AllReports allReports() { if (allReports == null) { allReports = new AllReports(reportRepository()); } return allReports; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
@Test public void testAllServicesProvided() { AllServicesProvided allServicesProvided = context.allServicesProvided(); Assert.assertNotNull(allServicesProvided); } | public AllServicesProvided allServicesProvided() { if (allServicesProvided == null) { allServicesProvided = new AllServicesProvided(serviceProvidedRepository()); } return allServicesProvided; } | Context { public AllServicesProvided allServicesProvided() { if (allServicesProvided == null) { allServicesProvided = new AllServicesProvided(serviceProvidedRepository()); } return allServicesProvided; } } | Context { public AllServicesProvided allServicesProvided() { if (allServicesProvided == null) { allServicesProvided = new AllServicesProvided(serviceProvidedRepository()); } return allServicesProvided; } protected Context(); } | Context { public AllServicesProvided allServicesProvided() { if (allServicesProvided == null) { allServicesProvided = new AllServicesProvided(serviceProvidedRepository()); } return allServicesProvided; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); } | Context { public AllServicesProvided allServicesProvided() { if (allServicesProvided == null) { allServicesProvided = new AllServicesProvided(serviceProvidedRepository()); } return allServicesProvided; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String>
customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.