@Test public void shouldSyncUpUnSyncedStockCardListWhenHasNotSyncedUpLatestMovementLastDay() throws Exception { when(mockedSharedPreferenceMgr.hasSyncedUpLatestMovementLastDay()).thenReturn(false); syncUpManager.syncUpUnSyncedStockCardCodes(); verify(mockedLmisRestApi).syncUpUnSyncedStockCards("123", new ArrayList<String>()); verify(mockedSharedPreferenceMgr).setLastMovementHandShakeDateToToday(); }
public void syncUpUnSyncedStockCardCodes() { if (sharedPreferenceMgr.hasSyncedUpLatestMovementLastDay()) { return; } try { List<String> unSyncedStockCardCodes = FluentIterable .from(stockMovementRepository.listUnSynced()) .transform(stockMovementItem -> stockMovementItem.getStockCard().getProduct().getCode()) .toList(); final String facilityId = UserInfoMgr.getInstance().getUser().getFacilityId(); lmisRestApi.syncUpUnSyncedStockCards(facilityId, unSyncedStockCardCodes); sharedPreferenceMgr.setLastMovementHandShakeDateToToday(); boolean isAllStockCardSyncSuccessful = unSyncedStockCardCodes.isEmpty(); if (isAllStockCardSyncSuccessful) { sharedPreferenceMgr.setStockLastSyncTime(); } } catch (LMISException e) { new LMISException(e, "SyncUpManager.syncUpUnSyncedStockCardCodes").reportToFabric(); } }
SyncUpManager { public void syncUpUnSyncedStockCardCodes() { if (sharedPreferenceMgr.hasSyncedUpLatestMovementLastDay()) { return; } try { List<String> unSyncedStockCardCodes = FluentIterable .from(stockMovementRepository.listUnSynced()) .transform(stockMovementItem -> stockMovementItem.getStockCard().getProduct().getCode()) .toList(); final String facilityId = UserInfoMgr.getInstance().getUser().getFacilityId(); lmisRestApi.syncUpUnSyncedStockCards(facilityId, unSyncedStockCardCodes); sharedPreferenceMgr.setLastMovementHandShakeDateToToday(); boolean isAllStockCardSyncSuccessful = unSyncedStockCardCodes.isEmpty(); if (isAllStockCardSyncSuccessful) { sharedPreferenceMgr.setStockLastSyncTime(); } } catch (LMISException e) { new LMISException(e, "SyncUpManager.syncUpUnSyncedStockCardCodes").reportToFabric(); } } }
SyncUpManager { public void syncUpUnSyncedStockCardCodes() { if (sharedPreferenceMgr.hasSyncedUpLatestMovementLastDay()) { return; } try { List<String> unSyncedStockCardCodes = FluentIterable .from(stockMovementRepository.listUnSynced()) .transform(stockMovementItem -> stockMovementItem.getStockCard().getProduct().getCode()) .toList(); final String facilityId = UserInfoMgr.getInstance().getUser().getFacilityId(); lmisRestApi.syncUpUnSyncedStockCards(facilityId, unSyncedStockCardCodes); sharedPreferenceMgr.setLastMovementHandShakeDateToToday(); boolean isAllStockCardSyncSuccessful = unSyncedStockCardCodes.isEmpty(); if (isAllStockCardSyncSuccessful) { sharedPreferenceMgr.setStockLastSyncTime(); } } catch (LMISException e) { new LMISException(e, "SyncUpManager.syncUpUnSyncedStockCardCodes").reportToFabric(); } } SyncUpManager(); }
SyncUpManager { public void syncUpUnSyncedStockCardCodes() { if (sharedPreferenceMgr.hasSyncedUpLatestMovementLastDay()) { return; } try { List<String> unSyncedStockCardCodes = FluentIterable .from(stockMovementRepository.listUnSynced()) .transform(stockMovementItem -> stockMovementItem.getStockCard().getProduct().getCode()) .toList(); final String facilityId = UserInfoMgr.getInstance().getUser().getFacilityId(); lmisRestApi.syncUpUnSyncedStockCards(facilityId, unSyncedStockCardCodes); sharedPreferenceMgr.setLastMovementHandShakeDateToToday(); boolean isAllStockCardSyncSuccessful = unSyncedStockCardCodes.isEmpty(); if (isAllStockCardSyncSuccessful) { sharedPreferenceMgr.setStockLastSyncTime(); } } catch (LMISException e) { new LMISException(e, "SyncUpManager.syncUpUnSyncedStockCardCodes").reportToFabric(); } } SyncUpManager(); boolean syncRnr(); boolean fakeSyncRnr(); boolean syncStockCards(); boolean fakeSyncStockCards(); void syncUpUnSyncedStockCardCodes(); void fakeSyncUpUnSyncedStockCardCodes(); void syncAppVersion(); void syncArchivedProducts(); void syncUpCmms(); void fakeSyncUpCmms(); boolean syncDeleteMovement(); void syncRapidTestForms(); void fakeSyncRapidTestForms(); }
SyncUpManager { public void syncUpUnSyncedStockCardCodes() { if (sharedPreferenceMgr.hasSyncedUpLatestMovementLastDay()) { return; } try { List<String> unSyncedStockCardCodes = FluentIterable .from(stockMovementRepository.listUnSynced()) .transform(stockMovementItem -> stockMovementItem.getStockCard().getProduct().getCode()) .toList(); final String facilityId = UserInfoMgr.getInstance().getUser().getFacilityId(); lmisRestApi.syncUpUnSyncedStockCards(facilityId, unSyncedStockCardCodes); sharedPreferenceMgr.setLastMovementHandShakeDateToToday(); boolean isAllStockCardSyncSuccessful = unSyncedStockCardCodes.isEmpty(); if (isAllStockCardSyncSuccessful) { sharedPreferenceMgr.setStockLastSyncTime(); } } catch (LMISException e) { new LMISException(e, "SyncUpManager.syncUpUnSyncedStockCardCodes").reportToFabric(); } } SyncUpManager(); boolean syncRnr(); boolean fakeSyncRnr(); boolean syncStockCards(); boolean fakeSyncStockCards(); void syncUpUnSyncedStockCardCodes(); void fakeSyncUpUnSyncedStockCardCodes(); void syncAppVersion(); void syncArchivedProducts(); void syncUpCmms(); void fakeSyncUpCmms(); boolean syncDeleteMovement(); void syncRapidTestForms(); void fakeSyncRapidTestForms();  }