use of com.annimon.stream.OptionalLong in project Lightweight-Stream-API by aNNiMON.
the class FindSingleTest method testFindSingleAfterFilteringToOneElementStream.
@Test
public void testFindSingleAfterFilteringToOneElementStream() {
OptionalLong result = LongStream.of(5, 10, -15).filter(Functions.remainderLong(2)).findSingle();
assertThat(result, hasValue(10L));
}
use of com.annimon.stream.OptionalLong in project Lightweight-Stream-API by aNNiMON.
the class OptionalLongMatcherTest method testHasValue.
@Test
public void testHasValue() {
OptionalLong optional = OptionalLong.of(42);
assertThat(optional, hasValue(42));
assertThat(optional, not(hasValue(13)));
assertThat(hasValue(42L), description(is("OptionalLong value is <42L>")));
}
use of com.annimon.stream.OptionalLong in project Lightweight-Stream-API by aNNiMON.
the class OptionalLongMatcherTest method testHasValueThat.
@Test
public void testHasValueThat() {
OptionalLong optional = OptionalLong.of(42L);
assertThat(optional, hasValueThat(is(not(17L))));
assertThat(hasValueThat(is(42L)), description(is("OptionalLong value is <42L>")));
}
use of com.annimon.stream.OptionalLong in project Lightweight-Stream-API by aNNiMON.
the class OptionalLongMatcherTest method testIsEmpty.
@Test
public void testIsEmpty() {
OptionalLong optional = OptionalLong.empty();
assertThat(optional, isEmpty());
assertThat(optional, not(isPresent()));
assertThat(isEmpty(), description(is("OptionalLong value should be empty")));
}
use of com.annimon.stream.OptionalLong in project Lightweight-Stream-API by aNNiMON.
the class FindSingleTest method testFindSingleAfterFilteringToEmptyStream.
@Test
public void testFindSingleAfterFilteringToEmptyStream() {
OptionalLong result = LongStream.of(5, 7, 9).filter(Functions.remainderLong(2)).findSingle();
assertThat(result, isEmpty());
}
Aggregations