SyncUpManager { public void syncAppVersion() { try { if (!sharedPreferenceMgr.hasSyncedVersion()) { AppInfoRequest request = new AppInfoRequest(UserInfoMgr.getInstance().getFacilityCode(), UserInfoMgr.getInstance().getUser().getUsername(), UserInfoMgr.getInstance().getVersion()); lmisRestApi.updateAppVersion(request); sharedPreferenceMgr.setSyncedVersion(true); } } catch (LMISException e) { new LMISException(e, "SyncUpManager.syncArchivedProducts").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();  }
@Test public void shouldSyncAppVersion() throws Exception { when(mockedSharedPreferenceMgr.hasSyncedVersion()).thenReturn(false); User user = new User(); UserInfoMgr.getInstance().setUser(user); syncUpManager.syncAppVersion(); verify(mockedLmisRestApi).updateAppVersion(any(AppInfoRequest.class)); }
@Test public void shouldNotSyncAppVersion() throws Exception { when(mockedSharedPreferenceMgr.hasSyncedVersion()).thenReturn(true); syncUpManager.syncAppVersion(); verify(mockedLmisRestApi, never()).updateAppVersion(any(AppInfoRequest.class)); }