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).saveANML... | @VisibleForTesting protected void removeLocationsFromHierarchy(LocationTree locationTree, Set<String> removedAssignments) throws AuthenticatorException, OperationCanceledException, IOException { for (String removedAssignment : removedAssignments) { locationTree.deleteLocation(removedAssignment); } settingsRepository.sa... | ValidateAssignmentHelper extends BaseHelper { @VisibleForTesting protected void removeLocationsFromHierarchy(LocationTree locationTree, Set<String> removedAssignments) throws AuthenticatorException, OperationCanceledException, IOException { for (String removedAssignment : removedAssignments) { locationTree.deleteLocati... | ValidateAssignmentHelper extends BaseHelper { @VisibleForTesting protected void removeLocationsFromHierarchy(LocationTree locationTree, Set<String> removedAssignments) throws AuthenticatorException, OperationCanceledException, IOException { for (String removedAssignment : removedAssignments) { locationTree.deleteLocati... | ValidateAssignmentHelper extends BaseHelper { @VisibleForTesting protected void removeLocationsFromHierarchy(LocationTree locationTree, Set<String> removedAssignments) throws AuthenticatorException, OperationCanceledException, IOException { for (String removedAssignment : removedAssignments) { locationTree.deleteLocati... | ValidateAssignmentHelper extends BaseHelper { @VisibleForTesting protected void removeLocationsFromHierarchy(LocationTree locationTree, Set<String> removedAssignments) throws AuthenticatorException, OperationCanceledException, IOException { for (String removedAssignment : removedAssignments) { locationTree.deleteLocati... |
@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"... | @VisibleForTesting protected void removeLocationsFromHierarchy(LocationTree locationTree, Set<String> removedAssignments) throws AuthenticatorException, OperationCanceledException, IOException { for (String removedAssignment : removedAssignments) { locationTree.deleteLocation(removedAssignment); } settingsRepository.sa... | ValidateAssignmentHelper extends BaseHelper { @VisibleForTesting protected void removeLocationsFromHierarchy(LocationTree locationTree, Set<String> removedAssignments) throws AuthenticatorException, OperationCanceledException, IOException { for (String removedAssignment : removedAssignments) { locationTree.deleteLocati... | ValidateAssignmentHelper extends BaseHelper { @VisibleForTesting protected void removeLocationsFromHierarchy(LocationTree locationTree, Set<String> removedAssignments) throws AuthenticatorException, OperationCanceledException, IOException { for (String removedAssignment : removedAssignments) { locationTree.deleteLocati... | ValidateAssignmentHelper extends BaseHelper { @VisibleForTesting protected void removeLocationsFromHierarchy(LocationTree locationTree, Set<String> removedAssignments) throws AuthenticatorException, OperationCanceledException, IOException { for (String removedAssignment : removedAssignments) { locationTree.deleteLocati... | ValidateAssignmentHelper extends BaseHelper { @VisibleForTesting protected void removeLocationsFromHierarchy(LocationTree locationTree, Set<String> removedAssignments) throws AuthenticatorException, OperationCanceledException, IOException { for (String removedAssignment : removedAssignments) { locationTree.deleteLocati... |
@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(ass... | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmen... | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmen... | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmen... | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmen... |
@Test public void testValidateUserAssignmentShouldDoNothingIfAPICallReturnsAnError() { when(allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED)).thenReturn(true); when(httpAgent.fetch(anyString())).thenReturn(new Response<>(ResponseStatus.failure, null)); validateAssignmentHelper.validateUserAssignment();... | 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(ass... | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmen... | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmen... | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmen... | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmen... |
@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... | 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(ass... | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmen... | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmen... | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmen... | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmen... |
@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> organizat... | 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(ass... | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmen... | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmen... | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmen... | ValidateAssignmentHelper extends BaseHelper { public void validateUserAssignment() { boolean keycloakConfigured = allSharedPreferences.getBooleanPreference(IS_KEYCLOAK_CONFIGURED); if (!keycloakConfigured) { return; } try { String assignment = getUserAssignment(); if (StringUtils.isNotBlank(assignment)) { UserAssignmen... |
@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(); batchSa... | 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 JSONA... | 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 JSONA... | 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 JSONA... | 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 JSONA... |
@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... | 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 co... | 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 co... | 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 co... |
@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(); tr... | 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 director... | 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... | 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... | 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... | 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... |
@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 - Uni... | 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( ... | 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 = getFormatted... | 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 = getFormatted... | 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 = getFormatted... | 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 = getFormatted... |
@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.fetchOpe... | 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( ... | 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 = getFormatted... | 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 = getFormatted... | 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 = getFormatted... | 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 = getFormatted... |
@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 ... | 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 ... | 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 co... | 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 co... | 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 co... | 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 co... |
@Test(expected = NoHttpResponseException.class) public void shouldThrowExceptionWhenFetchLocationsByLevelAndTagsReturnsFailedResponse() throws Exception { Mockito.doReturn(new Response<>(ResponseStatus.failure, "error")) .when(httpAgent).post(Mockito.anyString(), Mockito.anyString()); locationServiceHelper.fetchLocatio... | 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 ... | 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 co... | 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 co... | 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 co... | 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 co... |
@Test public void testFetchLocationsStructures() { locationServiceHelper.fetchLocationsStructures(); verify(locationServiceHelper).syncLocationsStructures(true); verify(locationServiceHelper).syncLocationsStructures(false); verify(locationServiceHelper).syncCreatedStructureToServer(); verify(locationServiceHelper).sync... | 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 locationRep... | LocationServiceHelper extends BaseHelper { public List<Location> fetchLocationsStructures() { syncLocationsStructures(true); List<Location> locations = syncLocationsStructures(false); syncCreatedStructureToServer(); syncUpdatedLocationsToServer(); return locations; } LocationServiceHelper(LocationRepository locationRep... | LocationServiceHelper extends BaseHelper { public List<Location> fetchLocationsStructures() { syncLocationsStructures(true); List<Location> locations = syncLocationsStructures(false); syncCreatedStructureToServer(); syncUpdatedLocationsToServer(); return locations; } LocationServiceHelper(LocationRepository locationRep... |
@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)... | public void syncCreatedStructureToServer() { List<Location> locations = structureRepository.getAllUnsynchedCreatedStructures(); if (!locations.isEmpty()) { String jsonPayload = locationGson.toJson(locations); String baseUrl = getFormattedBaseUrl(); Response<String> response = getHttpAgent().postWithJsonResponse( Messag... | 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 = ... | 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 = ... | 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 = ... | 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 = ... |
@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); whe... | 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_JURIS... | 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(); ... | 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(); ... | 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(); ... | 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(); ... |
@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\... | 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(AllC... | 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.p... | 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.p... | 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.p... | 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.p... |
@Test public void authorizeConnectionShouldCallOnConnectionAuthorizedWhenPeerDeviceTeamIdIsEqualsCurrentDeviceTeamId() { P2PAuthorizationService.AuthorizationCallback authorizationCallback = Mockito.mock(P2PAuthorizationService.AuthorizationCallback.class); HashMap<String, Object> peerDeviceMap = new HashMap<>(); peerD... | @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... | P2PSyncAuthorizationService implements P2PAuthorizationService { @Override public void authorizeConnection(@NonNull final Map<String, Object> peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback) { getAuthorizationDetails(new OnAuthorizationDetailsProvidedCallback() { @Override public void onAuthor... | P2PSyncAuthorizationService implements P2PAuthorizationService { @Override public void authorizeConnection(@NonNull final Map<String, Object> peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback) { getAuthorizationDetails(new OnAuthorizationDetailsProvidedCallback() { @Override public void onAuthor... | P2PSyncAuthorizationService implements P2PAuthorizationService { @Override public void authorizeConnection(@NonNull final Map<String, Object> peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback) { getAuthorizationDetails(new OnAuthorizationDetailsProvidedCallback() { @Override public void onAuthor... | P2PSyncAuthorizationService implements P2PAuthorizationService { @Override public void authorizeConnection(@NonNull final Map<String, Object> peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback) { getAuthorizationDetails(new OnAuthorizationDetailsProvidedCallback() { @Override public void onAuthor... |
@Test public void authorizeConnectionShouldCallOnConnectionAuthorizationRejectedWhenPeerDeviceTeamIdsAreNotEqual() { P2PAuthorizationService.AuthorizationCallback authorizationCallback = Mockito.mock(P2PAuthorizationService.AuthorizationCallback.class); HashMap<String, Object> peerDeviceMap = new HashMap<>(); peerDevic... | @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... | P2PSyncAuthorizationService implements P2PAuthorizationService { @Override public void authorizeConnection(@NonNull final Map<String, Object> peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback) { getAuthorizationDetails(new OnAuthorizationDetailsProvidedCallback() { @Override public void onAuthor... | P2PSyncAuthorizationService implements P2PAuthorizationService { @Override public void authorizeConnection(@NonNull final Map<String, Object> peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback) { getAuthorizationDetails(new OnAuthorizationDetailsProvidedCallback() { @Override public void onAuthor... | P2PSyncAuthorizationService implements P2PAuthorizationService { @Override public void authorizeConnection(@NonNull final Map<String, Object> peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback) { getAuthorizationDetails(new OnAuthorizationDetailsProvidedCallback() { @Override public void onAuthor... | P2PSyncAuthorizationService implements P2PAuthorizationService { @Override public void authorizeConnection(@NonNull final Map<String, Object> peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback) { getAuthorizationDetails(new OnAuthorizationDetailsProvidedCallback() { @Override public void onAuthor... |
@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 ... | 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 ... |
@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 AllConsta... | 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("ti... | 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("ti... | 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("ti... | 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("ti... |
@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 AllConsta... | 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("ti... | 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("ti... | 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("ti... | 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("ti... |
@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 AllConsta... | 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("ti... | 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("ti... | 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("ti... | 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("ti... |
@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 AllConsta... | 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("ti... | 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("ti... | 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("ti... | 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("ti... |
@Test public void onReceiveShouldShowToastWhenCloudantSyncReplicationError() { Intent intent = new Intent(AllConstants.CloudantSync.ACTION_REPLICATION_ERROR); openSRPClientBroadCastReceiver.onReceive(RuntimeEnvironment.application, intent); Mockito.verifyZeroInteractions(drishtiApplication); Mockito.verify(activity).sh... | @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 AllConsta... | 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("ti... | 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("ti... | 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("ti... | 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("ti... |
@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)... | 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(); ... | 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(); ... | 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(); ... | 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(); ... |
@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 Fil... | @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)... | 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(); ... | 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(); ... | 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(); ... | 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(); ... |
@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 ... | 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 ... |
@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 =... | 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) { d... | 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 && dens... | 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 && dens... | 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 && dens... | 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 && dens... |
@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", t... | 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, boole... | 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, boole... |
@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 ... | 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 ... |
@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 ... | 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 ... |
@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 d... | 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 d... |
@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 d... | 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 d... |
@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); assertEqual... | 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(Str... | 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(Str... |
@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 C... | 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(Str... | 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(Str... |
@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(Str... | 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(Str... |
@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)... | 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)... |
@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)... | 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)... |
@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 screen... | 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) { d... | 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 && dens... | 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 && dens... | 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 && dens... | 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 && dens... |
@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... | 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 convertDate... | 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 convertDate... |
@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), "d... | 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 convertDate... | 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 convertDate... |
@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... | 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 convertD... | 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 convertD... |
@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(ma... | 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; } } re... | 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... | 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... | 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... | 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... |
@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 suppressExce... | 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 suppressExce... |
@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... | 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, Stri... | 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, Stri... |
@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); ass... | 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, Stri... | 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, Stri... |
@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); ... | 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, Stri... | 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, Stri... |
@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) ro... | 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, Stri... | 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, Stri... |
@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(SyncStatusBroadcastR... | 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 inte... | 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); ret... | 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); ret... | 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); ret... | 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); ret... |
@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 s... | 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) { d... | 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 && dens... | 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 && dens... | 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 && dens... | 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 && dens... |
@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 suppressExcep... | 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 suppressExcep... |
@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 suppressExcep... | 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 suppressExcep... |
@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 suppressExcep... | 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 suppressExcep... |
@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 suppressExcep... | 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 suppressExcep... |
@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 D... | 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 D... |
@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(Strin... | 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(Strin... |
@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 sup... | 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 sup... |
@Test public void testGetFilterValueShouldGetCorrectFilterValue() { LoginResponseData loginResponseData = getLoginResponseData(); LoginResponse loginResponse = LoginResponse.SUCCESS.withPayload(loginResponseData); assertEquals(loginResponseData.team.team.uuid, Utils.getFilterValue(loginResponse, SyncFilter.TEAM)); asse... | 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.... | 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.te... | 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.te... | 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.te... | 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.te... |
@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", appPropertie... | 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 proper... | 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 proper... | 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 proper... | 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 proper... |
@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,... | 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,... |
@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.Screen... | 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) { d... | 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 && dens... | 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 && dens... | 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 && dens... | 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 && dens... |
@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... | 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... |
@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); stati... | 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); stati... |
@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(St... | 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(St... |
@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 supp... | 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 supp... |
@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(), U... | 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 suppre... | 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 suppre... |
@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, S... | 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, S... |
@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 suppressExceptio... | 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 suppressExceptio... |
@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 suppressExc... | 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 suppressExc... |
@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();... | 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();... |
@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 bene... | 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 bene... |
@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); D... | 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(Activit... | 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(Activit... |
@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(); C... | 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(); C... |
@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(); ... | 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(); ... |
@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 application... | 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 application... |
@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 be... | 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 be... |
@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 applicationC... | 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 applicationC... |
@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... | 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... |
@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 applicationC... | 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 applicationC... |
@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 applic... | 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 applic... |
@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(); Be... | 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(); Be... |
@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(); Be... | 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(); Be... |
@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);... | 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(Activ... | 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(Activ... |
@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); andr... | 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); andr... |
@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.con... | 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.con... |
@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 app... | 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 app... |
@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.cont... | 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.cont... |
@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(ziggySe... | Context { public FormSubmissionService formSubmissionService() { if (formSubmissionService == null) { if (commonFtsObject != null) { formSubmissionService = new FormSubmissionService(ziggyService(), formDataRepository(), allSettings(), allCommonsRepositoryMap()); } else { formSubmissionService = new FormSubmissionServi... | Context { public FormSubmissionService formSubmissionService() { if (formSubmissionService == null) { if (commonFtsObject != null) { formSubmissionService = new FormSubmissionService(ziggyService(), formDataRepository(), allSettings(), allCommonsRepositoryMap()); } else { formSubmissionService = new FormSubmissionServi... | Context { public FormSubmissionService formSubmissionService() { if (formSubmissionService == null) { if (commonFtsObject != null) { formSubmissionService = new FormSubmissionService(ziggyService(), formDataRepository(), allSettings(), allCommonsRepositoryMap()); } else { formSubmissionService = new FormSubmissionServi... | Context { public FormSubmissionService formSubmissionService() { if (formSubmissionService == null) { if (commonFtsObject != null) { formSubmissionService = new FormSubmissionService(ziggyService(), formDataRepository(), allSettings(), allCommonsRepositoryMap()); } else { formSubmissionService = new FormSubmissionServi... |
@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(); s... | Context { public AllFormVersionSyncService allFormVersionSyncService() { if (allFormVersionSyncService == null) { allFormVersionSyncService = new AllFormVersionSyncService(httpAgent(), configuration(), formsVersionRepository()); } return allFormVersionSyncService; } protected Context(); static Context getInstance(); s... |
@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(), ancRegistrationOAHandl... | Context { public FormSubmissionRouter formSubmissionRouter() { if (formSubmissionRouter == null) { formSubmissionRouter = new FormSubmissionRouter(formDataRepository(), ecRegistrationHandler(), fpComplicationsHandler(), fpChangeHandler(), renewFPProductHandler(), ecCloseHandler(), ancRegistrationHandler(), ancRegistrat... | Context { public FormSubmissionRouter formSubmissionRouter() { if (formSubmissionRouter == null) { formSubmissionRouter = new FormSubmissionRouter(formDataRepository(), ecRegistrationHandler(), fpComplicationsHandler(), fpChangeHandler(), renewFPProductHandler(), ecCloseHandler(), ancRegistrationHandler(), ancRegistrat... | Context { public FormSubmissionRouter formSubmissionRouter() { if (formSubmissionRouter == null) { formSubmissionRouter = new FormSubmissionRouter(formDataRepository(), ecRegistrationHandler(), fpComplicationsHandler(), fpChangeHandler(), renewFPProductHandler(), ecCloseHandler(), ancRegistrationHandler(), ancRegistrat... | Context { public FormSubmissionRouter formSubmissionRouter() { if (formSubmissionRouter == null) { formSubmissionRouter = new FormSubmissionRouter(formDataRepository(), ecRegistrationHandler(), fpComplicationsHandler(), fpChangeHandler(), renewFPProductHandler(), ecCloseHandler(), ancRegistrationHandler(), ancRegistrat... |
@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 ... | 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 ... |
@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.cont... | 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.cont... |
@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 formSubmissionSyncServ... | Context { public FormSubmissionSyncService formSubmissionSyncService() { if (formSubmissionSyncService == null) { formSubmissionSyncService = new FormSubmissionSyncService(formSubmissionService(), httpAgent(), formDataRepository(), allSettings(), allSharedPreferences(), configuration()); } return formSubmissionSyncServ... | Context { public FormSubmissionSyncService formSubmissionSyncService() { if (formSubmissionSyncService == null) { formSubmissionSyncService = new FormSubmissionSyncService(formSubmissionService(), httpAgent(), formDataRepository(), allSettings(), allSharedPreferences(), configuration()); } return formSubmissionSyncServ... | Context { public FormSubmissionSyncService formSubmissionSyncService() { if (formSubmissionSyncService == null) { formSubmissionSyncService = new FormSubmissionSyncService(formSubmissionService(), httpAgent(), formDataRepository(), allSettings(), allSharedPreferences(), configuration()); } return formSubmissionSyncServ... |
@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 displ... | 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; doubl... | 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)... | 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)... | 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)... | 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)... |
@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()); dri... | Context { public ArrayList<DrishtiRepository> sharedRepositories() { assignbindtypes(); ArrayList<DrishtiRepository> drishtireposotorylist = new ArrayList<DrishtiRepository>(); drishtireposotorylist.add(settingsRepository()); drishtireposotorylist.add(alertRepository()); drishtireposotorylist.add(eligibleCoupleReposito... | Context { public ArrayList<DrishtiRepository> sharedRepositories() { assignbindtypes(); ArrayList<DrishtiRepository> drishtireposotorylist = new ArrayList<DrishtiRepository>(); drishtireposotorylist.add(settingsRepository()); drishtireposotorylist.add(alertRepository()); drishtireposotorylist.add(eligibleCoupleReposito... | Context { public ArrayList<DrishtiRepository> sharedRepositories() { assignbindtypes(); ArrayList<DrishtiRepository> drishtireposotorylist = new ArrayList<DrishtiRepository>(); drishtireposotorylist.add(settingsRepository()); drishtireposotorylist.add(alertRepository()); drishtireposotorylist.add(eligibleCoupleReposito... | Context { public ArrayList<DrishtiRepository> sharedRepositories() { assignbindtypes(); ArrayList<DrishtiRepository> drishtireposotorylist = new ArrayList<DrishtiRepository>(); drishtireposotorylist.add(settingsRepository()); drishtireposotorylist.add(alertRepository()); drishtireposotorylist.add(eligibleCoupleReposito... |
@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(); s... | Context { public DrishtiRepository[] sharedRepositoriesArray() { ArrayList<DrishtiRepository> drishtiRepositories = sharedRepositories(); DrishtiRepository[] drishtireposotoryarray = drishtiRepositories .toArray(new DrishtiRepository[drishtiRepositories.size()]); return drishtireposotoryarray; } protected Context(); s... |
@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 applicat... | 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 applicat... |
@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 beneficiaryServi... | 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 beneficiaryServi... |
@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.Co... | 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.Co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.