@Test public void shouldLoadDataWhenCalledSubscriberOnNext() throws Exception { RnRForm form = new RnRForm(); Program program = new Program(); program.setProgramCode("MMIA"); form.setProgram(program); form.setPeriodBegin(new Date()); form.setPeriodEnd(new Date()); rnRFormListActivity.getRnRFormSubscriber().onNext(newArrayList(RnRFormViewModel.buildNormalRnrViewModel(form), RnRFormViewModel.buildNormalRnrViewModel(form))); assertThat(rnRFormListActivity.listView.getAdapter().getItemCount()).isEqualTo(2); }
protected Subscriber<List<RnRFormViewModel>> getRnRFormSubscriber() { return new Subscriber<List<RnRFormViewModel>>() { @Override public void onCompleted() { loaded(); } @Override public void onError(Throwable e) { loaded(); ToastUtil.show(e.getMessage()); } @Override public void onNext(List<RnRFormViewModel> rnRFormViewModels) { data.clear(); data.addAll(rnRFormViewModels); adapter.notifyDataSetChanged(); } }; }
RnRFormListActivity extends BaseReportListActivity { protected Subscriber<List<RnRFormViewModel>> getRnRFormSubscriber() { return new Subscriber<List<RnRFormViewModel>>() { @Override public void onCompleted() { loaded(); } @Override public void onError(Throwable e) { loaded(); ToastUtil.show(e.getMessage()); } @Override public void onNext(List<RnRFormViewModel> rnRFormViewModels) { data.clear(); data.addAll(rnRFormViewModels); adapter.notifyDataSetChanged(); } }; } }
RnRFormListActivity extends BaseReportListActivity { protected Subscriber<List<RnRFormViewModel>> getRnRFormSubscriber() { return new Subscriber<List<RnRFormViewModel>>() { @Override public void onCompleted() { loaded(); } @Override public void onError(Throwable e) { loaded(); ToastUtil.show(e.getMessage()); } @Override public void onNext(List<RnRFormViewModel> rnRFormViewModels) { data.clear(); data.addAll(rnRFormViewModels); adapter.notifyDataSetChanged(); } }; }  }
RnRFormListActivity extends BaseReportListActivity { protected Subscriber<List<RnRFormViewModel>> getRnRFormSubscriber() { return new Subscriber<List<RnRFormViewModel>>() { @Override public void onCompleted() { loaded(); } @Override public void onError(Throwable e) { loaded(); ToastUtil.show(e.getMessage()); } @Override public void onNext(List<RnRFormViewModel> rnRFormViewModels) { data.clear(); data.addAll(rnRFormViewModels); adapter.notifyDataSetChanged(); } }; }  static Intent getIntentToMe(Context context, Constants.Program programCode); @Override void onActivityResult(int requestCode, int resultCode, Intent data); @Override boolean onCreateOptionsMenu(Menu menu); @Override boolean onPrepareOptionsMenu(Menu menu); @Override boolean onOptionsItemSelected(MenuItem item); }
RnRFormListActivity extends BaseReportListActivity { protected Subscriber<List<RnRFormViewModel>> getRnRFormSubscriber() { return new Subscriber<List<RnRFormViewModel>>() { @Override public void onCompleted() { loaded(); } @Override public void onError(Throwable e) { loaded(); ToastUtil.show(e.getMessage()); } @Override public void onNext(List<RnRFormViewModel> rnRFormViewModels) { data.clear(); data.addAll(rnRFormViewModels); adapter.notifyDataSetChanged(); } }; }  static Intent getIntentToMe(Context context, Constants.Program programCode); @Override void onActivityResult(int requestCode, int resultCode, Intent data); @Override boolean onCreateOptionsMenu(Menu menu); @Override boolean onPrepareOptionsMenu(Menu menu); @Override boolean onOptionsItemSelected(MenuItem item); static final int DEFAULT_FORM_ID_OF_NOT_AUTHORIZED; }