Fixed failing test

This commit is contained in:
Trustin Lee 2010-01-14 12:24:59 +00:00
parent 3ee7604591
commit 238bdc90b8

View File

@ -23,6 +23,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.channels.GatheringByteChannel;
import java.nio.channels.ScatteringByteChannel;
@ -95,10 +96,11 @@ public class ReadOnlyChannelBufferTest {
ByteBuffer bb = ByteBuffer.allocate(100);
ByteBuffer[] bbs = new ByteBuffer[] { ByteBuffer.allocate(101), ByteBuffer.allocate(102) };
CharBuffer cb = CharBuffer.allocate(100);
expect(buf.toByteBuffer(23, 24)).andReturn(bb);
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);
replay(buf);
@ -126,7 +128,7 @@ public class ReadOnlyChannelBufferTest {
assertEquals(102, roBBs[1].capacity());
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());
verify(buf);