You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/12/04 14:40:47 UTC
(commons-io) branch master updated: Sort members
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git
The following commit(s) were added to refs/heads/master by this push:
new c819db0d Sort members
c819db0d is described below
commit c819db0dc744ac015993413e44dfb79840389e19
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Dec 4 09:40:42 2023 -0500
Sort members
---
.../io/input/CharSequenceInputStreamTest.java | 68 +++++++++++-----------
1 file changed, 34 insertions(+), 34 deletions(-)
diff --git a/src/test/java/org/apache/commons/io/input/CharSequenceInputStreamTest.java b/src/test/java/org/apache/commons/io/input/CharSequenceInputStreamTest.java
index 24bdce35..6c98827b 100644
--- a/src/test/java/org/apache/commons/io/input/CharSequenceInputStreamTest.java
+++ b/src/test/java/org/apache/commons/io/input/CharSequenceInputStreamTest.java
@@ -300,6 +300,40 @@ public class CharSequenceInputStreamTest {
testSingleByteRead(LARGE_TEST_STRING, UTF_8);
}
+ // This test doesn't work for charsets that don't create a single byte for each char.
+ // Use testMarkResetMultiByteChars() instead for those cases.
+ private void testMarkReset(final String csName) throws Exception {
+ try (InputStream r = new CharSequenceInputStream("test", csName)) {
+ assertEquals(2, r.skip(2));
+ r.mark(0);
+ assertEquals('s', r.read(), csName);
+ assertEquals('t', r.read(), csName);
+ assertEquals(-1, r.read(), csName);
+ r.reset();
+ assertEquals('s', r.read(), csName);
+ assertEquals('t', r.read(), csName);
+ assertEquals(-1, r.read(), csName);
+ r.reset();
+ r.reset();
+ }
+ }
+
+ @ParameterizedTest
+ @MethodSource(CharsetsTest.REQUIRED_CHARSETS)
+ public void testMarkReset_RequiredCharsets(final String csName) throws Exception {
+ testMarkResetMultiByteChars(csName);
+ }
+
+ @Test
+ public void testMarkReset_USASCII() throws Exception {
+ testMarkReset("US-ASCII");
+ }
+
+ @Test
+ public void testMarkReset_UTF8() throws Exception {
+ testMarkReset(UTF_8);
+ }
+
private void testMarkResetMultiByteChars(final String csName) throws IOException {
// This test quietly skips Charsets that can't handle multibyte characters like ASCII.
final String sequenceEnglish = "Test Sequence";
@@ -341,40 +375,6 @@ public class CharSequenceInputStreamTest {
}
}
- // This test doesn't work for charsets that don't create a single byte for each char.
- // Use testMarkResetMultiByteChars() instead for those cases.
- private void testMarkReset(final String csName) throws Exception {
- try (InputStream r = new CharSequenceInputStream("test", csName)) {
- assertEquals(2, r.skip(2));
- r.mark(0);
- assertEquals('s', r.read(), csName);
- assertEquals('t', r.read(), csName);
- assertEquals(-1, r.read(), csName);
- r.reset();
- assertEquals('s', r.read(), csName);
- assertEquals('t', r.read(), csName);
- assertEquals(-1, r.read(), csName);
- r.reset();
- r.reset();
- }
- }
-
- @ParameterizedTest
- @MethodSource(CharsetsTest.REQUIRED_CHARSETS)
- public void testMarkReset_RequiredCharsets(final String csName) throws Exception {
- testMarkResetMultiByteChars(csName);
- }
-
- @Test
- public void testMarkReset_USASCII() throws Exception {
- testMarkReset("US-ASCII");
- }
-
- @Test
- public void testMarkReset_UTF8() throws Exception {
- testMarkReset(UTF_8);
- }
-
@Test
public void testMarkSupported() throws Exception {
try (@SuppressWarnings("deprecation")