DvrApiImpl extends BaseApi implements DvrApi { @Override public Observable<List<TitleInfoEntity>> titleInfoEntityList() { return Observable.create( new Observable.OnSubscribe<List<TitleInfoEntity>>() { @Override public void call( Subscriber<? super List<TitleInfoEntity>> subscriber ) { Log.d(TAG, "titleInfoEntityList.call : enter"); if( isThereInternetConnection() ) { Log.d( TAG, "titleInfoEntityList.call : network is connected" ); try { String responseRecordedProgramEntities = getTitleInfoEntitiesFromApi(); if( null == responseRecordedProgramEntities ) { Log.d( TAG, "titleInfoEntityList.call : failed to retrieve title info entities" ); subscriber.onError( new NetworkConnectionException() ); } else { Log.d( TAG, "titleInfoEntityList.call : retrieved title info entities" ); subscriber.onNext( titleInfoEntityJsonMapper.transformTitleInfoEntityCollection( responseRecordedProgramEntities ) ); subscriber.onCompleted(); } } catch( Exception e ) { Log.e( TAG, "titleInfoEntityList.call : error", e ); subscriber.onError( new NetworkConnectionException( e.getCause() ) ); } } else { Log.d( TAG, "titleInfoEntityList.call : network is not connected" ); subscriber.onError( new NetworkConnectionException() ); } Log.d( TAG, "titleInfoEntityList.call : exit" ); } }); } DvrApiImpl( final Context context, final SharedPreferences sharedPreferences, final OkHttpClient okHttpClient, final TitleInfoEntityJsonMapper titleInfoEntityJsonMapper, final ProgramEntityJsonMapper programEntityJsonMapper, final EncoderEntityJsonMapper encoderEntityJsonMapper, final BooleanJsonMapper booleanJsonMapper, final LongJsonMapper longJsonMapper ); @Override Observable<List<TitleInfoEntity>> titleInfoEntityList(); @Override Observable<List<ProgramEntity>> recordedProgramEntityList( final boolean descending, final int startIndex, final int count, final String titleRegEx, final String recGroup, final String storageGroup ); @Override Observable<ProgramEntity> recordedProgramById( final int recordedId, final int chanId, final DateTime startTime ); @Override Observable<List<ProgramEntity>> upcomingProgramEntityList( int startIndex, int count, boolean showAll, int recordId, int recStatus ); @Override Observable<List<EncoderEntity>> encoderEntityList(); @Override Observable<Boolean> updateWatchedStatus( final int id, final boolean watched ); @Override Observable<Long> getBookmark( final int recordedId, final int chanId, final DateTime startTime, final String offsetType);  }
@Test public void testTitleInfoEntityList() throws Exception{ Observable<List<TitleInfoEntity>> titleInfoEntityList = api.titleInfoEntityList(); assertThat(titleInfoEntityList, not(nullValue())); }