use of com.kickstarter.services.apiresponses.MessageThreadEnvelope in project android-oss by kickstarter.
the class MessagesViewModelTest method testNoMessages.
@Test
public void testNoMessages() {
final Backing backing = BackingFactory.backing();
final Project project = ProjectFactory.project();
final MockApiClient apiClient = new MockApiClient() {
@Override
@NonNull
public Observable<MessageThreadEnvelope> fetchMessagesForBacking(@NonNull final Backing backing) {
return Observable.just(MessageThreadEnvelopeFactory.empty());
}
};
setUpEnvironment(environment().toBuilder().apiClient(apiClient).currentUser(new MockCurrentUser(UserFactory.user())).build());
// Start the view model with a backing and a project.
this.vm.intent(backerModalContextIntent(backing, project));
// All data except for messages should emit.
this.messageList.assertNoValues();
this.creatorNameTextViewText.assertValues(project.creator().name());
this.backingAndProject.assertValues(Pair.create(backing, project));
}
use of com.kickstarter.services.apiresponses.MessageThreadEnvelope in project android-oss by kickstarter.
the class MessagesViewModelTest method testMessageEditTextHint.
@Test
public void testMessageEditTextHint() {
final MessageThread messageThread = MessageThreadFactory.messageThread();
final MockApiClient apiClient = new MockApiClient() {
@Override
@NonNull
public Observable<MessageThreadEnvelope> fetchMessagesForThread(@NonNull final MessageThread thread) {
return Observable.just(MessageThreadEnvelopeFactory.messageThreadEnvelope());
}
};
setUpEnvironment(environment().toBuilder().apiClient(apiClient).currentUser(new MockCurrentUser(UserFactory.user())).build());
// Start the view model with a message thread.
this.vm.intent(messagesContextIntent(messageThread));
this.messageEditTextHint.assertValues(messageThread.project().creator().name());
}
Aggregations