### Question:
ByteArrayOutputStream extends OutputStream { public void reset() { count = 0; } ByteArrayOutputStream();  ByteArrayOutputStream(int size); ByteArrayRange closeAndGetByteArray(); void reset(); int getLength(); ByteArrayRange getByteArray(); byte[] toByteArray(); @Override void write(byte[] buffer, int offset, int length); @Override void write(int oneByte);  }### Answer:
@Test public void testReset() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] data = new byte[] { 1, 2, 3}; baos.write(data); baos.reset(); byte newFirst = 5; baos.write(newFirst); byte[] sut = baos.getByteArray().toByteArray(); baos.close(); assertArrayEquals(sut, new byte[] { newFirst }); }