1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.lang3.stream;
19
20 import static org.junit.jupiter.api.Assertions.assertArrayEquals;
21 import static org.junit.jupiter.api.Assertions.assertEquals;
22 import static org.junit.jupiter.api.Assertions.assertNotNull;
23
24 import org.apache.commons.lang3.AbstractLangTest;
25 import org.junit.jupiter.api.Test;
26
27
28
29
30 class IntStreamsTest extends AbstractLangTest {
31
32 @SuppressWarnings("deprecation")
33 @Test
34 void testDeprecatedConstructor() {
35 assertNotNull(new IntStreams().toString());
36 }
37
38 @Test
39 void testOfArray() {
40 assertEquals(0, IntStreams.of((int[]) null).count());
41 assertEquals(1, IntStreams.of(1).count());
42 assertEquals(2, IntStreams.of(1, 2).count());
43 }
44
45 @Test
46 void testRange() {
47 assertArrayEquals(new int[] { 0, 1 }, IntStreams.range(2).toArray());
48 }
49
50 @Test
51 void testRangeClosed() {
52 assertArrayEquals(new int[] { 0, 1, 2 }, IntStreams.rangeClosed(2).toArray());
53 }
54 }