Update javaxval/src/test/java/org/baeldung/javaxval/messageinterpolator/ParameterMessageInterpolaterIntegrationTest.java

update to use the givenX_whenY_thenZ naming convention for tests

Co-Authored-By: KevinGilmore <kpg102@gmail.com>
This commit is contained in:
Yavuz Tas
2019-10-29 10:02:27 +01:00
committed by GitHub
parent db85c8f275
commit e28fd3e7c9
20479 changed files with 1642089 additions and 0 deletions
@@ -0,0 +1,40 @@
package com.baeldung.rxjava;
import org.junit.Test;
import io.reactivex.Flowable;
import io.reactivex.Maybe;
public class MaybeUnitTest {
@Test
public void whenEmitsSingleValue_thenItIsObserved() {
Maybe<Integer> maybe = Flowable.just(1, 2, 3, 4, 5)
.firstElement();
maybe.map(x -> x + 7)
.filter(x -> x > 0)
.test()
.assertResult(8)
.assertComplete();
}
@Test
public void whenEmitsNoValue_thenSignalsCompletionAndNoValueObserved() {
Maybe<Integer> maybe = Flowable.just(1, 2, 3, 4, 5)
.skip(5)
.firstElement();
maybe.test()
.assertComplete()
.assertNoValues();
}
@Test
public void whenThrowsError_thenErrorIsRaised() {
Maybe<Integer> maybe = Flowable.<Integer> error(new Exception("msg"))
.firstElement();
maybe.test()
.assertErrorMessage("msg");
}
}