@Test public void shouldShowErrorMsgWhenNeverSyncSuccessful() throws Exception { when(sharedPreferenceMgr.getRnrLastSyncTime()).thenReturn(0l); when(sharedPreferenceMgr.getStockLastSyncTime()).thenReturn(0l); when(syncErrorsRepository.hasSyncErrorOf(anyObject())).thenReturn(true); syncTimeView.showLastSyncTime(); assertThat(syncTimeView.txSyncTime.getText().toString(), is("Initial sync failed")); assertNull(syncTimeView.ivSyncTimeIcon.getDrawable()); }
public void showLastSyncTime() { hideSyncProgressBarAndShowIcon(); rnrLastSyncTime = sharedPreferenceMgr.getRnrLastSyncTime(); stockLastSyncTime = sharedPreferenceMgr.getStockLastSyncTime(); if (isNeverSyncSuccessful()) { if (hasSyncFailed()) { txSyncTime.setText(LMISApp.getContext().getString(R.string.initial_sync_failed)); } return; } txSyncTime.setText(updateSyncTimeViewUI()); if (sharedPreferenceMgr.isStockCardLastYearSyncError()) { setSyncStockCardLastYearError(); } }
SyncTimeView extends LinearLayout implements View.OnClickListener { public void showLastSyncTime() { hideSyncProgressBarAndShowIcon(); rnrLastSyncTime = sharedPreferenceMgr.getRnrLastSyncTime(); stockLastSyncTime = sharedPreferenceMgr.getStockLastSyncTime(); if (isNeverSyncSuccessful()) { if (hasSyncFailed()) { txSyncTime.setText(LMISApp.getContext().getString(R.string.initial_sync_failed)); } return; } txSyncTime.setText(updateSyncTimeViewUI()); if (sharedPreferenceMgr.isStockCardLastYearSyncError()) { setSyncStockCardLastYearError(); } } }
SyncTimeView extends LinearLayout implements View.OnClickListener { public void showLastSyncTime() { hideSyncProgressBarAndShowIcon(); rnrLastSyncTime = sharedPreferenceMgr.getRnrLastSyncTime(); stockLastSyncTime = sharedPreferenceMgr.getStockLastSyncTime(); if (isNeverSyncSuccessful()) { if (hasSyncFailed()) { txSyncTime.setText(LMISApp.getContext().getString(R.string.initial_sync_failed)); } return; } txSyncTime.setText(updateSyncTimeViewUI()); if (sharedPreferenceMgr.isStockCardLastYearSyncError()) { setSyncStockCardLastYearError(); } } SyncTimeView(Context context);  SyncTimeView(Context context, AttributeSet attrs); }
SyncTimeView extends LinearLayout implements View.OnClickListener { public void showLastSyncTime() { hideSyncProgressBarAndShowIcon(); rnrLastSyncTime = sharedPreferenceMgr.getRnrLastSyncTime(); stockLastSyncTime = sharedPreferenceMgr.getStockLastSyncTime(); if (isNeverSyncSuccessful()) { if (hasSyncFailed()) { txSyncTime.setText(LMISApp.getContext().getString(R.string.initial_sync_failed)); } return; } txSyncTime.setText(updateSyncTimeViewUI()); if (sharedPreferenceMgr.isStockCardLastYearSyncError()) { setSyncStockCardLastYearError(); } } SyncTimeView(Context context);  SyncTimeView(Context context, AttributeSet attrs); void showLastSyncTime(); @Override void onClick(View v); void showSyncProgressBarAndHideIcon(); void setSyncStockCardLastYearText(); void setSyncStockCardLastYearError(); void setSyncedMovementError(String error); }
SyncTimeView extends LinearLayout implements View.OnClickListener { public void showLastSyncTime() { hideSyncProgressBarAndShowIcon(); rnrLastSyncTime = sharedPreferenceMgr.getRnrLastSyncTime(); stockLastSyncTime = sharedPreferenceMgr.getStockLastSyncTime(); if (isNeverSyncSuccessful()) { if (hasSyncFailed()) { txSyncTime.setText(LMISApp.getContext().getString(R.string.initial_sync_failed)); } return; } txSyncTime.setText(updateSyncTimeViewUI()); if (sharedPreferenceMgr.isStockCardLastYearSyncError()) { setSyncStockCardLastYearError(); } } SyncTimeView(Context context);  SyncTimeView(Context context, AttributeSet attrs); void showLastSyncTime(); @Override void onClick(View v); void showSyncProgressBarAndHideIcon(); void setSyncStockCardLastYearText(); void setSyncStockCardLastYearError(); void setSyncedMovementError(String error);  }