diff --git a/src/test/java/net/kemitix/mon/MaybeTest.java b/src/test/java/net/kemitix/mon/MaybeTest.java index f0a241a..bb8676d 100644 --- a/src/test/java/net/kemitix/mon/MaybeTest.java +++ b/src/test/java/net/kemitix/mon/MaybeTest.java @@ -21,42 +21,6 @@ public class MaybeTest { return v -> Objects.equals(value, v); } - @Test - public void documentation() { - assertThat(Maybe.maybe(null)).isEqualTo(Maybe.nothing()); - assertThat(Maybe.maybe(1)).isEqualTo(Maybe.just(1)); - assertThat(Maybe.nothing() - .orElseGet(() -> 1)).isEqualTo(1); - assertThat(Maybe.just(1) - .orElseGet(() -> 2)).isEqualTo(1); - assertThat(Maybe.nothing() - .orElse(1)).isEqualTo(1); - assertThat(Maybe.just(1) - .orElse(2)).isEqualTo(1); - assertThat(Maybe.just(1) - .filter(v -> v > 2)).isEqualTo(Maybe.nothing()); - assertThat(Maybe.just(3) - .filter(v -> v > 2)).isEqualTo(Maybe.just(3)); - assertThat(Maybe.just(1) - .toOptional()).isEqualTo(Optional.of(1)); - assertThat(Maybe.nothing() - .toOptional()).isEqualTo(Optional.empty()); - assertThat(Maybe.fromOptional(Optional.of(1))).isEqualTo(Maybe.just(1)); - assertThat(Maybe.fromOptional(Optional.empty())).isEqualTo(Maybe.nothing()); - final AtomicInteger reference = new AtomicInteger(0); - assertThat(Maybe.just(1) - .peek(reference::set)).isEqualTo(Maybe.just(1)); - assertThat(reference).hasValue(1); - assertThat(Maybe.nothing() - .peek(v -> reference.incrementAndGet())).isEqualTo(Maybe.nothing()); - assertThat(reference).hasValue(1); - assertThatCode(() -> Maybe.just(1) - .orElseThrow(IllegalStateException::new)).doesNotThrowAnyException(); - assertThatThrownBy(() -> Maybe.nothing() - .orElseThrow(IllegalStateException::new)).isInstanceOf( - IllegalStateException.class); - } - @Test public void justMustBeNonNull() { assertThatNullPointerException().isThrownBy(() -> just(null))