Skip to content

Commit 057d3b2

Browse files
committed
Sort members
1 parent 581b44f commit 057d3b2

2 files changed

Lines changed: 27 additions & 27 deletions

File tree

src/test/java/org/apache/commons/io/input/UnsynchronizedBufferedReaderTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@
5151
*/
5252
class UnsynchronizedBufferedReaderTest {
5353

54-
private UnsynchronizedBufferedReader reader;
55-
5654
/** All line endings in the test fixture are LF (\n). */
5755
private static final String LINES =
5856
"Test_All_Tests\nTest_java_io_BufferedInputStream\nTest_java_io_BufferedOutputStream\nTest_java_io_ByteArrayInputStream\n"
@@ -82,6 +80,8 @@ class UnsynchronizedBufferedReaderTest {
8280
+ "Test_java_util_EventObject\nTest_java_util_HashEnumerator\nTest_java_util_Hashtable\nTest_java_util_Properties\nTest_java_util_ResourceBundle\n"
8381
+ "Test_java_util_tm\nTest_java_util_Vector\n";
8482

83+
private UnsynchronizedBufferedReader reader;
84+
8585
/**
8686
* Tears down the fixture, for example, close a network connection. This method is called after a test is executed.
8787
*/

src/test/java/org/apache/commons/io/input/buffer/PeekableInputStreamTest.java

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,31 @@ void testIO683() throws IOException {
6767
}
6868
}
6969

70+
@Test
71+
void testPeekDoesNotConsumeBytes() throws IOException {
72+
final byte[] input = "Some".getBytes(StandardCharsets.UTF_8);
73+
try (PeekableInputStream inputStream = new PeekableInputStream(new ByteArrayInputStream(input))) {
74+
assertTrue(inputStream.peek(input));
75+
assertEquals('S', inputStream.read());
76+
}
77+
}
78+
79+
@Test
80+
void testPeekExactMatch() throws IOException {
81+
final byte[] input = "Some text buffer".getBytes(StandardCharsets.UTF_8);
82+
try (PeekableInputStream inputStream = new PeekableInputStream(new ByteArrayInputStream(input))) {
83+
assertTrue(inputStream.peek(input));
84+
}
85+
}
86+
87+
@Test
88+
void testPeekPrefixDoesNotMatchLongerInput() throws IOException {
89+
try (PeekableInputStream inputStream = new PeekableInputStream(
90+
new ByteArrayInputStream("Some text buffer".getBytes(StandardCharsets.UTF_8)))) {
91+
assertFalse(inputStream.peek("Some".getBytes(StandardCharsets.UTF_8)));
92+
}
93+
}
94+
7095
@Test
7196
void testRandomRead() throws Exception {
7297
final byte[] inputBuffer = newInputBuffer();
@@ -102,29 +127,4 @@ void testRandomRead() throws Exception {
102127
}
103128
assertTrue(true, "Test finished OK");
104129
}
105-
106-
@Test
107-
void testPeekExactMatch() throws IOException {
108-
final byte[] input = "Some text buffer".getBytes(StandardCharsets.UTF_8);
109-
try (PeekableInputStream inputStream = new PeekableInputStream(new ByteArrayInputStream(input))) {
110-
assertTrue(inputStream.peek(input));
111-
}
112-
}
113-
114-
@Test
115-
void testPeekPrefixDoesNotMatchLongerInput() throws IOException {
116-
try (PeekableInputStream inputStream = new PeekableInputStream(
117-
new ByteArrayInputStream("Some text buffer".getBytes(StandardCharsets.UTF_8)))) {
118-
assertFalse(inputStream.peek("Some".getBytes(StandardCharsets.UTF_8)));
119-
}
120-
}
121-
122-
@Test
123-
void testPeekDoesNotConsumeBytes() throws IOException {
124-
final byte[] input = "Some".getBytes(StandardCharsets.UTF_8);
125-
try (PeekableInputStream inputStream = new PeekableInputStream(new ByteArrayInputStream(input))) {
126-
assertTrue(inputStream.peek(input));
127-
assertEquals('S', inputStream.read());
128-
}
129-
}
130130
}

0 commit comments

Comments
 (0)