Code example for CharBuffer

Methods: hasArray

0
    @TestTargetNew( 
        level = TestLevel.PARTIAL_COMPLETE, 
        notes = "Verifies append method with the same CharSequence object for which it's called.", 
        method = "append", 
        args = {java.lang.CharSequence.class}
    ) 
    public void testAppendSelf() throws Exception { 
        CharBuffer cb = CharBuffer.allocate(10);
        CharBuffer cb2 = cb.duplicate();
        cb.append(cb);
        assertEquals(10, cb.position());
        cb.clear();
        assertEquals(cb2, cb);
 
        cb.put("abc");
        cb2 = cb.duplicate();
        cb.append(cb);
        assertEquals(10, cb.position());
        cb.clear();
        cb2.clear();
        assertEquals(cb2, cb);