ParseConversationDataSource implements ConversationDataSource<ExampleConversation> { @NonNull @Override public Observable<Void> markRead(MarkConversationReadQuery query) { final Map<String, Object> params = new HashMap<>(); params.put(MarkChatReadFunc.Fields.CHAT_ID, query.getConversationId()); return mParseHelper.<ParseObject>callFunction(MarkChatReadFunc.NAME, params) .ignoreElements() .cast(Void.class) .subscribeOn(Schedulers.io()); } ParseConversationDataSource(@NonNull ParseHelper parseHelper); void reloadConversation(@NonNull String chatId); @NonNull @Override Observable<LoadResult<ExampleConversation>> load(LoadConversationsQuery<ExampleConversation> query); @NonNull @Override Observable<ExampleConversation> get(GetConversationQuery query); @NonNull @Override Observable<Boolean> subscribe(SubscribeToUpdatesQuery query); @NonNull @Override Observable<ExampleConversation> create(CreateGroupConversationQuery query); @NonNull @Override Observable<ExampleConversation> create(CreateConversationQuery query); @NonNull @Override Observable<Void> markRead(MarkConversationReadQuery query); @NonNull @Override Observable<List<ExampleConversation>> delete(DeleteConversationsQuery<ExampleConversation> query);  }
@Test public void markConversationRead() { String chatId = "chatId"; final Map<String, Object> expectedParams = new HashMap<>(); expectedParams.put(MarkChatReadFunc.Fields.CHAT_ID, chatId); when(mMockParseHelper.<ParseObject>callFunction(eq(MarkChatReadFunc.NAME), argThat(MapMatchers.matchesEntriesIn(expectedParams)))) .thenReturn(Observable.empty()); final TestSubscriber<Void> testSubscriber = executeTarget( mTarget.markRead(new MarkConversationReadQuery(chatId))); testSubscriber.assertCompleted(); assertThat(testSubscriber.getOnNextEvents().size(), is(0)); }