DvrApiImpl extends BaseApi implements DvrApi { @Override public Observable<ProgramEntity> recordedProgramById( final int recordedId, final int chanId, final DateTime startTime ) { return Observable.create( new Observable.OnSubscribe<ProgramEntity>() { @Override public void call( Subscriber<? super ProgramEntity> subscriber ) { if( isThereInternetConnection() ) { try { String responseProgramDetails = getRecordedProgramDetailsFromApi( recordedId, chanId, startTime ); if( null == responseProgramDetails ) { subscriber.onError( new NetworkConnectionException() ); } else { subscriber.onNext( programEntityJsonMapper.transformProgramEntity( responseProgramDetails ) ); subscriber.onCompleted(); } } catch( Exception e ) { subscriber.onError( new NetworkConnectionException( e.getCause() ) ); } } else { subscriber.onError( new NetworkConnectionException() ); } } }); } 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 testRecordedProgramEntity() throws Exception{ Observable<ProgramEntity> recordedProgramEntity = api.recordedProgramById( 1, 1, new DateTime() ); assertThat( recordedProgramEntity, not( nullValue() ) ); }