@Test public void testMediaItemsHappyCase() { TestSubscriber<Object> subscriber = new TestSubscriber<>(); List<MediaItemEntity> mediaItemsList = new ArrayList<>(); mediaItemsList.add( mediaItemEntity() ); given( mockMediaItemDataStore.mediaItems( any( Media.class ), anyString() ) ).willReturn( Observable.just( mediaItemsList ) ); mediaItemDataRepository.mediaItems( FAKE_MEDIA, FAKE_TITLE ) .subscribe( subscriber ); assertThat( subscriber.getOnNextEvents() ) .isNotNull() .hasSize( 1 ); verify( mockMediaItemDataStoreFactory, times( 1 ) ).createMasterBackendDataStore(); verify( mockMediaItemDataStoreFactory, times( 0 ) ).create( anyInt() ); verify( mockMediaItemDataStore ).mediaItems( any( Media.class ), anyString() ); }
@SuppressWarnings( CONVERT2METHODREF ) @Override public Observable<List<MediaItem>> mediaItems( final Media media, @Nullable final String title ) { MediaItemDataStore mediaItemDataStore = mediaItemDataStoreFactory.createMasterBackendDataStore(); return mediaItemDataStore.mediaItems( media, title ) .map( MediaItemDataMapper::transformMediaItems ); }
MediaItemDataRepository implements MediaItemRepository { @SuppressWarnings( CONVERT2METHODREF ) @Override public Observable<List<MediaItem>> mediaItems( final Media media, @Nullable final String title ) { MediaItemDataStore mediaItemDataStore = mediaItemDataStoreFactory.createMasterBackendDataStore(); return mediaItemDataStore.mediaItems( media, title ) .map( MediaItemDataMapper::transformMediaItems ); } }
MediaItemDataRepository implements MediaItemRepository { @SuppressWarnings( CONVERT2METHODREF ) @Override public Observable<List<MediaItem>> mediaItems( final Media media, @Nullable final String title ) { MediaItemDataStore mediaItemDataStore = mediaItemDataStoreFactory.createMasterBackendDataStore(); return mediaItemDataStore.mediaItems( media, title ) .map( MediaItemDataMapper::transformMediaItems ); } @Inject  MediaItemDataRepository(
            final MediaItemDataStoreFactory mediaItemDataStoreFactory
    ); }
MediaItemDataRepository implements MediaItemRepository { @SuppressWarnings( CONVERT2METHODREF ) @Override public Observable<List<MediaItem>> mediaItems( final Media media, @Nullable final String title ) { MediaItemDataStore mediaItemDataStore = mediaItemDataStoreFactory.createMasterBackendDataStore(); return mediaItemDataStore.mediaItems( media, title ) .map( MediaItemDataMapper::transformMediaItems ); } @Inject  MediaItemDataRepository(
            final MediaItemDataStoreFactory mediaItemDataStoreFactory
    ); @SuppressWarnings( CONVERT2METHODREF ) @Override Observable<List<Series>> series( Media media ); @SuppressWarnings( CONVERT2METHODREF ) @Override Observable<List<MediaItem>> mediaItems( final Media media, @Nullable final String title ); @SuppressWarnings( CONVERT2METHODREF ) @Override Observable<MediaItem> mediaItem( final Media media, final int id ); @Override Observable<MediaItem> addLiveStream( final Media media, final int id ); @Override Observable<MediaItem> removeLiveStream( final Media media, final int id ); @Override Observable<MediaItem> updateWatchedStatus( Media media, int id, boolean watched ); @SuppressWarnings( CONVERT2METHODREF ) @Override Observable<List<MediaItem>> search( String searchString ); }
MediaItemDataRepository implements MediaItemRepository { @SuppressWarnings( CONVERT2METHODREF ) @Override public Observable<List<MediaItem>> mediaItems( final Media media, @Nullable final String title ) { MediaItemDataStore mediaItemDataStore = mediaItemDataStoreFactory.createMasterBackendDataStore(); return mediaItemDataStore.mediaItems( media, title ) .map( MediaItemDataMapper::transformMediaItems ); } @Inject  MediaItemDataRepository(
            final MediaItemDataStoreFactory mediaItemDataStoreFactory
    ); @SuppressWarnings( CONVERT2METHODREF ) @Override Observable<List<Series>> series( Media media ); @SuppressWarnings( CONVERT2METHODREF ) @Override Observable<List<MediaItem>> mediaItems( final Media media, @Nullable final String title ); @SuppressWarnings( CONVERT2METHODREF ) @Override Observable<MediaItem> mediaItem( final Media media, final int id ); @Override Observable<MediaItem> addLiveStream( final Media media, final int id ); @Override Observable<MediaItem> removeLiveStream( final Media media, final int id ); @Override Observable<MediaItem> updateWatchedStatus( Media media, int id, boolean watched ); @SuppressWarnings( CONVERT2METHODREF ) @Override Observable<List<MediaItem>> search( String searchString );  }