### Question:
CommitOutputStream extends OutputStream { public void close() throws IOException { m_sink.close(); } CommitOutputStream(OutputStream sink); void write(int data); void write(byte buffer[], int offset, int length); int getSize(); void commit(); void rollback(); void flush(); void close();  }### Answer:
@Test public void close() throws IOException { CountedOutputStream counted; CommitOutputStream fixture; counted = new CountedOutputStream(); fixture = new CommitOutputStream(counted); fixture.write(10); fixture.close(); assertEquals(0, counted.getWriteCount()); assertEquals(1, counted.getCloseCount()); assertEquals(1, fixture.getSize()); }