### Question:
AudioBuffer { public int append(short data[]){ synchronized (this) { int size = Math.min(mData.length - mLastWriteData, data.length); System.arraycopy(data, 0, mData, mLastWriteData, size); mLastWriteData += size; return mLastWriteData; } } AudioBuffer(int samplingRate, int maxLengthSec); int getSamplingRate(); int append(short data[]); boolean isFull(); int getBufferLength(); void writeLittleEndianTo(OutputStream out); synchronized void writeTo(AudioTrack out);  }### Answer:
@Test public void appendReturnCurrentBufferSize(){ final int samplingRate =10; final int dataSize=7; AudioBuffer buf = new AudioBuffer(samplingRate,1); Assert.assertEquals(dataSize,buf.append(new short[dataSize])); Assert.assertEquals(samplingRate,buf.append(new short[dataSize])); }
@Test public void appendEmptyDataDoesntDoAnything(){ final int samplingRate =10; final int dataSize=7; AudioBuffer buf = new AudioBuffer(samplingRate,1); Assert.assertEquals(dataSize,buf.append(new short[dataSize])); Assert.assertEquals(dataSize,buf.append(new short[0])); }