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
commit 3d412ccc0826a5eaaacb32b735909ce4e44e6c91 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Thu May 23 10:35:53 2024 -0400 Sort members --- .../apache/commons/io/function/IOIteratorTest.java | 8 ++--- .../io/input/buffer/CircularByteBufferTest.java | 40 +++++++++++----------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/test/java/org/apache/commons/io/function/IOIteratorTest.java b/src/test/java/org/apache/commons/io/function/IOIteratorTest.java index f39703161..4aeb739f4 100644 --- a/src/test/java/org/apache/commons/io/function/IOIteratorTest.java +++ b/src/test/java/org/apache/commons/io/function/IOIteratorTest.java @@ -51,13 +51,13 @@ public class IOIteratorTest { } @Test - public void testAdaptIterator() throws IOException { - assertEquals(TestConstants.ABS_PATH_A, iterator.next()); + public void testAdaptIterable() throws IOException { + assertEquals(TestConstants.ABS_PATH_A, IOIterator.adapt(newPathList()).next()); } @Test - public void testAdaptIterable() throws IOException { - assertEquals(TestConstants.ABS_PATH_A, IOIterator.adapt(newPathList()).next()); + public void testAdaptIterator() throws IOException { + assertEquals(TestConstants.ABS_PATH_A, iterator.next()); } @Test diff --git a/src/test/java/org/apache/commons/io/input/buffer/CircularByteBufferTest.java b/src/test/java/org/apache/commons/io/input/buffer/CircularByteBufferTest.java index 2c3bfe234..1b2816c46 100644 --- a/src/test/java/org/apache/commons/io/input/buffer/CircularByteBufferTest.java +++ b/src/test/java/org/apache/commons/io/input/buffer/CircularByteBufferTest.java @@ -58,6 +58,26 @@ public class CircularByteBufferTest { assertEquals(length, cbb.getCurrentNumberOfBytes()); } + @Test + public void testClear() { + final byte[] data = new byte[] { 1, 2, 3 }; + final CircularByteBuffer buffer = new CircularByteBuffer(10); + assertEquals(0, buffer.getCurrentNumberOfBytes()); + assertFalse(buffer.hasBytes()); + + buffer.add(data, 0, data.length); + assertEquals(3, buffer.getCurrentNumberOfBytes()); + assertEquals(7, buffer.getSpace()); + assertTrue(buffer.hasBytes()); + assertTrue(buffer.hasSpace()); + + buffer.clear(); + assertEquals(0, buffer.getCurrentNumberOfBytes()); + assertEquals(10, buffer.getSpace()); + assertFalse(buffer.hasBytes()); + assertTrue(buffer.hasSpace()); + } + @Test public void testPeekWithExcessiveLength() { assertFalse(new CircularByteBuffer().peek(new byte[] { 1, 3, 5, 7, 9 }, 0, 6)); @@ -82,24 +102,4 @@ public class CircularByteBufferTest { public void testPeekWithValidArguments() { assertFalse(new CircularByteBuffer().peek(new byte[] { 5, 10, 15, 20, 25 }, 0, 5)); } - - @Test - public void testClear() { - final byte[] data = new byte[] { 1, 2, 3 }; - final CircularByteBuffer buffer = new CircularByteBuffer(10); - assertEquals(0, buffer.getCurrentNumberOfBytes()); - assertFalse(buffer.hasBytes()); - - buffer.add(data, 0, data.length); - assertEquals(3, buffer.getCurrentNumberOfBytes()); - assertEquals(7, buffer.getSpace()); - assertTrue(buffer.hasBytes()); - assertTrue(buffer.hasSpace()); - - buffer.clear(); - assertEquals(0, buffer.getCurrentNumberOfBytes()); - assertEquals(10, buffer.getSpace()); - assertFalse(buffer.hasBytes()); - assertTrue(buffer.hasSpace()); - } }