1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.io.build;
18
19 import static org.junit.jupiter.api.Assertions.assertThrows;
20
21 import java.io.FileInputStream;
22 import java.io.FileNotFoundException;
23 import java.io.IOException;
24 import java.io.InputStream;
25 import java.nio.file.OpenOption;
26 import java.nio.file.StandardOpenOption;
27
28 import org.apache.commons.io.build.AbstractOrigin.InputStreamOrigin;
29 import org.apache.commons.io.input.CharSequenceInputStream;
30 import org.junit.jupiter.api.Test;
31 import org.junit.jupiter.params.ParameterizedTest;
32 import org.junit.jupiter.params.provider.EnumSource;
33
34
35
36
37
38
39
40
41 class InputStreamOriginTest extends AbstractOriginTest<InputStream, InputStreamOrigin> {
42
43 @SuppressWarnings("resource")
44 @Override
45 protected InputStreamOrigin newOriginRo() throws FileNotFoundException {
46 return new InputStreamOrigin(new FileInputStream(FILE_NAME_RO));
47 }
48
49 @SuppressWarnings("resource")
50 @Override
51 protected InputStreamOrigin newOriginRw() {
52 return new InputStreamOrigin(CharSequenceInputStream.builder().setCharSequence("World").get());
53 }
54
55 @Override
56 @Test
57 void testGetFile() {
58
59 assertThrows(UnsupportedOperationException.class, super::testGetFile);
60 }
61
62 @Override
63 @Test
64 void testGetOutputStream() {
65
66 assertThrows(UnsupportedOperationException.class, super::testGetOutputStream);
67 }
68
69 @Override
70 @Test
71 void testGetPath() {
72
73 assertThrows(UnsupportedOperationException.class, super::testGetPath);
74 }
75
76 @Override
77 @Test
78 void testGetRandomAccessFile() {
79
80 assertThrows(UnsupportedOperationException.class, super::testGetRandomAccessFile);
81 }
82
83 @Override
84 @ParameterizedTest
85 @EnumSource(StandardOpenOption.class)
86 void testGetRandomAccessFile(final OpenOption openOption) {
87
88 assertThrows(UnsupportedOperationException.class, () -> super.testGetRandomAccessFile(openOption));
89 }
90
91 @Override
92 @Test
93 void testGetWritableByteChannel() throws IOException {
94
95 assertThrows(UnsupportedOperationException.class, super::testGetWritableByteChannel);
96 }
97
98 @Override
99 @Test
100 void testGetWriter() {
101
102 assertThrows(UnsupportedOperationException.class, super::testGetWriter);
103 }
104 }