Search in sources :

Example 91 with IntStream

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);
}
Also used : IntStream(java.util.stream.IntStream) Test(org.junit.Test)

Example 92 with IntStream

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));
}
Also used : IntStream(java.util.stream.IntStream) Test(org.junit.jupiter.api.Test)

Example 93 with IntStream

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);
}
Also used : IntStream(java.util.stream.IntStream) Test(org.junit.jupiter.api.Test)

Example 94 with IntStream

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());
}
Also used : IntStream(java.util.stream.IntStream) Test(org.junit.jupiter.api.Test)

Example 95 with IntStream

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.");
}
Also used : IntStream(java.util.stream.IntStream) Test(org.junit.jupiter.api.Test)

Aggregations

IntStream (java.util.stream.IntStream)96 List (java.util.List)19 Test (org.junit.jupiter.api.Test)17 ArrayList (java.util.ArrayList)15 Stream (java.util.stream.Stream)12 Test (org.junit.Test)12 Arrays (java.util.Arrays)11 Map (java.util.Map)10 Collectors (java.util.stream.Collectors)9 Random (java.util.Random)7 DoubleStream (java.util.stream.DoubleStream)6 LongStream (java.util.stream.LongStream)6 Function (java.util.function.Function)5 Pattern (java.util.regex.Pattern)5 DecimalBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.decimalBox.definition.DecimalBoxFieldDefinition)5 MultipleSubFormFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.multipleSubform.definition.MultipleSubFormFieldDefinition)5 SubFormFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.subForm.definition.SubFormFieldDefinition)5 FieldDefinition (org.kie.workbench.common.forms.model.FieldDefinition)5 LayoutRow (org.uberfire.ext.layout.editor.api.editor.LayoutRow)5 LayoutTemplate (org.uberfire.ext.layout.editor.api.editor.LayoutTemplate)5