MasterBackendVideoDataStore implements VideoDataStore { @Override public Observable<List<VideoMetadataInfoEntity>> getVideos( String folder, String sort, boolean descending, int startIndex, int count ) { Log.d( TAG, "getVideos : enter" ); Log.d( TAG, "getVideos : folder=" + folder + ", sort=" + sort + ", descending=" + descending + ", startIndex=" + startIndex + ", count=" + count ); Observable<List<VideoMetadataInfoEntity>> videoList = this.api.getVideoList( folder, sort, descending, startIndex, count ) .subscribeOn( Schedulers.io() ) .observeOn( AndroidSchedulers.mainThread() ); Log.d( TAG, "getVideos : exit" ); return videoList; } MasterBackendVideoDataStore( VideoApi api ); @Override Observable<List<VideoMetadataInfoEntity>> getVideos( String folder, String sort, boolean descending, int startIndex, int count ); @Override Observable<List<VideoMetadataInfoEntity>> getCategory( final String category ); @Override Observable<List<VideoMetadataInfoEntity>> getSeriesInCategory( String category, String series ); @Override Observable<VideoMetadataInfoEntity> getVideoById( int id ); @Override Observable<VideoMetadataInfoEntity> getVideoByFilename( String filename ); @Override Observable<Boolean> updateWatchedStatus( final int videoId, final boolean watched );  }
@Test public void testGetVideos() { List<VideoMetadataInfoEntity> fakeVideoMetadataInfoEntities = new ArrayList<>(); VideoMetadataInfoEntity fakeVideoMetadataInfoEntity = createVideoMetadataInfoEntity(); fakeVideoMetadataInfoEntities.add( fakeVideoMetadataInfoEntity ); Observable<List<VideoMetadataInfoEntity>> fakeObservable = Observable.just( fakeVideoMetadataInfoEntities ); given( mockVideoApi.getVideoList( null, null, false, -1, -1 ) ).willReturn( fakeObservable ); masterBackendVideoDataStore.getVideos(null, null, false, -1, -1); verify( mockVideoApi ).getVideoList( null, null, false, -1, -1); }