Fixed failing test
This commit is contained in:
parent
3ee7604591
commit
238bdc90b8
@ -23,6 +23,7 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.CharBuffer;
|
||||||
import java.nio.channels.GatheringByteChannel;
|
import java.nio.channels.GatheringByteChannel;
|
||||||
import java.nio.channels.ScatteringByteChannel;
|
import java.nio.channels.ScatteringByteChannel;
|
||||||
|
|
||||||
@ -95,10 +96,11 @@ public class ReadOnlyChannelBufferTest {
|
|||||||
|
|
||||||
ByteBuffer bb = ByteBuffer.allocate(100);
|
ByteBuffer bb = ByteBuffer.allocate(100);
|
||||||
ByteBuffer[] bbs = new ByteBuffer[] { ByteBuffer.allocate(101), ByteBuffer.allocate(102) };
|
ByteBuffer[] bbs = new ByteBuffer[] { ByteBuffer.allocate(101), ByteBuffer.allocate(102) };
|
||||||
|
CharBuffer cb = CharBuffer.allocate(100);
|
||||||
|
|
||||||
expect(buf.toByteBuffer(23, 24)).andReturn(bb);
|
expect(buf.toByteBuffer(23, 24)).andReturn(bb);
|
||||||
expect(buf.toByteBuffers(25, 26)).andReturn(bbs);
|
expect(buf.toByteBuffers(25, 26)).andReturn(bbs);
|
||||||
expect(buf.getString(27, 28, CharsetUtil.UTF_8)).andReturn("29");
|
expect(buf.getString(27, 28, cb, CharsetUtil.UTF_8)).andReturn(29);
|
||||||
expect(buf.capacity()).andReturn(30);
|
expect(buf.capacity()).andReturn(30);
|
||||||
|
|
||||||
replay(buf);
|
replay(buf);
|
||||||
@ -126,7 +128,7 @@ public class ReadOnlyChannelBufferTest {
|
|||||||
assertEquals(102, roBBs[1].capacity());
|
assertEquals(102, roBBs[1].capacity());
|
||||||
assertTrue(roBBs[1].isReadOnly());
|
assertTrue(roBBs[1].isReadOnly());
|
||||||
|
|
||||||
assertEquals("29", roBuf.getString(27, 28, CharsetUtil.UTF_8));
|
assertEquals(29, roBuf.getString(27, 28, cb, CharsetUtil.UTF_8));
|
||||||
assertEquals(30, roBuf.capacity());
|
assertEquals(30, roBuf.capacity());
|
||||||
|
|
||||||
verify(buf);
|
verify(buf);
|
||||||
|
Loading…
Reference in New Issue
Block a user