use of java.util.stream.IntStream in project javacore by wang125631.
the class Demo06 method test01.
/**
* ����Stream����
*/
@Test
public void test01() {
// һ.ͨ��Collectionϵ�м����ṩ��
// 1.������ stream()
// 2.������ paralleStream()
Stream<Student06> stream = list.stream();
// ��.ͨ��Arrays�еľ�̬����
IntStream stream2 = Arrays.stream(new int[10]);
// ��.ͨ��Stream���еľ�̬����
Stream<String> stream3 = Stream.of("aa", "bb", "cc");
// ��.����������
// ����
Stream<Integer> stream4 = Stream.iterate(0, (x) -> x + 2);
stream4.limit(4).forEach(System.out::println);
// ����
Stream.generate(() -> Math.random()).limit(5).forEach(System.out::println);
}
use of java.util.stream.IntStream in project assertj-core by joel-costigliola.
the class Assertions_assertThat_with_IntStream_Test method should_initialise_actual.
@SuppressWarnings("unchecked")
@Test
void should_initialise_actual() {
IntStream iterator = IntStream.of(823952, 1947230585);
List<? extends Integer> actual = assertThat(iterator).actual;
assertThat((List<Integer>) actual).contains(823952, atIndex(0)).contains(1947230585, atIndex(1));
}
use of java.util.stream.IntStream in project assertj-core by joel-costigliola.
the class Assertions_assertThat_with_IntStream_Test method isEqualTo_should_honor_comparing_the_same_mocked_stream.
@Test
void isEqualTo_should_honor_comparing_the_same_mocked_stream() {
IntStream stream = mock(IntStream.class);
assertThat(stream).isEqualTo(stream);
}
use of java.util.stream.IntStream in project assertj-core by joel-costigliola.
the class Assertions_assertThat_with_IntStream_Test method isOfAnyClassIn_should_check_the_original_stream_without_consuming_it.
@Test
void isOfAnyClassIn_should_check_the_original_stream_without_consuming_it() {
IntStream stream = mock(IntStream.class);
assertThat(stream).isOfAnyClassIn(Double.class, stream.getClass());
}
use of java.util.stream.IntStream in project assertj-core by joel-costigliola.
the class Assertions_assertThat_with_IntStream_Test method isNotSameAs_should_check_the_original_stream_without_consuming_it.
@Test
void isNotSameAs_should_check_the_original_stream_without_consuming_it() {
IntStream stream = mock(IntStream.class);
try {
assertThat(stream).isNotSameAs(stream);
} catch (AssertionError e) {
verifyNoInteractions(stream);
return;
}
Assertions.fail("Expected assertionError, because assert notSame on same stream.");
}
Aggregations