[DEPRECATED] AssertJ assertions for RxJava Observables
Assertj-rx is now deprecated. In-order to test observabales, please use the TestSubscriber - more information on this can be found here. Whilst the current version still remains usable, there will no longer be any new development taking place.
AssertJ assertions for RxJava Observables.
This library extends AssertJ core with the aim of providing elegant assertions to test RxJava Observables. The current version of this library only provides assertions aimed at testing "cold" Observables. You will need to transform your Observable into a
BlockingObservablebefore performing any assertion.
Feedback and contributions are very welcome.
java assertThat(observable.toBlocking()).completes();
java assertThat(observable.toBlocking()) .completes() .emitsSingleValue("hello");
java assertThat(observable.toBlocking()) .completes() .emitsNoValues();
java assertThat(observable.toBlocking()).fails();
IllegalArgumentException
java assertThat(observable.toBlocking()) .failsWithError(IllegalArgumentException.class);
java assertThat(observable.toBlocking()) .completes() .listOfValuesEmitted() .containsExactly("a", "b", "c");
java assertThat(observable.toBlocking()) .fails() .listOfValuesEmitted() .containsExactly("a", "b");
java assertThat(observable.toBlocking()) .completes() .valuesCountIs(10);## Installation
Artifacts are on Maven central.
Gradle:
groovy testCompile 'uk.co.ribot.assertj-rx:assertj-rx:0.1.0'Maven:
xml uk.co.ribot.assertj-rx assertj-rx 0.1.0 testAlternatively, you can download the jar from the releases section.
Copyright (C) 2015 Ribot Ltd.Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.