@@ -0,0 +1,1041 @@
+package org.apache.commons.net.ssh.util;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Aimport java.io.UnsupportedEncodingException;%0A%0Aimport org.apache.commons.net.ssh.util.Buffer.BufferException;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0A/**%0A * Sample unit test for testing %7B@link Buffer%7D functionality%0A * @author rorywinston%0A *%0A */%0Apublic class BufferTest %7B%0A%09private Buffer buf;%0A%0A%09@Before()%0A%09public void setUp() throws UnsupportedEncodingException %7B%0A%09%09byte%5B%5D data = %22Hello%22.getBytes(%22UTF-8%22);%0A%09%09buf = new Buffer(data);%0A%09%7D%0A%0A%09@Test%0A%09public void testBufferPosition() throws UnsupportedEncodingException %7B%0A%09%09assertEquals(5, buf.wpos());%0A%09%09assertEquals(0, buf.rpos());%0A%09%09assertEquals(5, buf.available());%0A%0A%09%09// read some bytes%0A%09%09byte b = buf.getByte();%0A%09%09assertEquals(b, (byte)'H');%0A%0A%09%09assertEquals(1, buf.rpos());%0A%09%09assertEquals(4, buf.available());%0A%09%7D%0A%0A%09@Test(expected=BufferException.class)%0A%09public void testUnderflow() %7B%0A%09%09// exhaust the buffer%0A%09%09for (int i = 0; i %3C 5; ++i)%0A%09%09%09buf.getByte();%09%09 %0A%09%09// underflow%0A%09%09buf.getByte();%0A%09%7D%0A%7D%0A

Add sample unit test, showing initialization, simple checks and expected exceptions