@Test public void loadFormShouldInstallTestFormIfTestId() { TestObserver observer = new TestObserver<Boolean>(); when(mockDatabaseDataSource.installTestForm()).thenReturn(Observable.just(true)); formDataRepository.loadForm("0", "deviceId").subscribe(observer); verify(mockDatabaseDataSource, times(1)).installTestForm(); observer.assertNoErrors(); }
@Override public Observable<Boolean> loadForm(String formId, String deviceId) { final DatabaseDataSource dataBaseDataSource = dataSourceFactory.getDataBaseDataSource(); if (TEST_FORM_ID.equals(formId)) { return dataBaseDataSource.installTestForm(); } else { return downloadFormHeader(formId, deviceId); } }
FormDataRepository implements FormRepository { @Override public Observable<Boolean> loadForm(String formId, String deviceId) { final DatabaseDataSource dataBaseDataSource = dataSourceFactory.getDataBaseDataSource(); if (TEST_FORM_ID.equals(formId)) { return dataBaseDataSource.installTestForm(); } else { return downloadFormHeader(formId, deviceId); } } }
FormDataRepository implements FormRepository { @Override public Observable<Boolean> loadForm(String formId, String deviceId) { final DatabaseDataSource dataBaseDataSource = dataSourceFactory.getDataBaseDataSource(); if (TEST_FORM_ID.equals(formId)) { return dataBaseDataSource.installTestForm(); } else { return downloadFormHeader(formId, deviceId); } } @Inject  FormDataRepository(FormHeaderParser formHeaderParser, XmlFormParser xmlParser,
                              RestApi restApi, DataSourceFactory dataSourceFactory, FormIdMapper formIdMapper,
                              S3RestApi s3RestApi, DomainFormMapper domainFormMapper); }
FormDataRepository implements FormRepository { @Override public Observable<Boolean> loadForm(String formId, String deviceId) { final DatabaseDataSource dataBaseDataSource = dataSourceFactory.getDataBaseDataSource(); if (TEST_FORM_ID.equals(formId)) { return dataBaseDataSource.installTestForm(); } else { return downloadFormHeader(formId, deviceId); } } @Inject  FormDataRepository(FormHeaderParser formHeaderParser, XmlFormParser xmlParser,
                              RestApi restApi, DataSourceFactory dataSourceFactory, FormIdMapper formIdMapper,
                              S3RestApi s3RestApi, DomainFormMapper domainFormMapper); @Override Observable<Boolean> loadForm(String formId, String deviceId); @Override Observable<Integer> reloadForms(final String deviceId); @Override Observable<Integer> downloadForms(final String deviceId); @Override @NotNull Single<DomainForm> getForm(@NotNull String formId); }
FormDataRepository implements FormRepository { @Override public Observable<Boolean> loadForm(String formId, String deviceId) { final DatabaseDataSource dataBaseDataSource = dataSourceFactory.getDataBaseDataSource(); if (TEST_FORM_ID.equals(formId)) { return dataBaseDataSource.installTestForm(); } else { return downloadFormHeader(formId, deviceId); } } @Inject  FormDataRepository(FormHeaderParser formHeaderParser, XmlFormParser xmlParser,
                              RestApi restApi, DataSourceFactory dataSourceFactory, FormIdMapper formIdMapper,
                              S3RestApi s3RestApi, DomainFormMapper domainFormMapper); @Override Observable<Boolean> loadForm(String formId, String deviceId); @Override Observable<Integer> reloadForms(final String deviceId); @Override Observable<Integer> downloadForms(final String deviceId); @Override @NotNull Single<DomainForm> getForm(@NotNull String formId);  }