### Question:
ManagedOutputStream extends FilterOutputStream { @Override public void close() throws IOException { if (!closed) { super.close(); closed = true; listener.notifyClosed(this); } } ManagedOutputStream(CloseListener listener, OutputStream stream, BlobStoreConnection con); BlobStoreConnection getConnection(); @Override void write(byte[] b, int off, int len); @Override void close();  }### Answer:
@Test public void testCloseNotification() throws Exception { MockCloseListener listener = new MockCloseListener(); ManagedOutputStream managed = new ManagedOutputStream(listener, new ByteArrayOutputStream(), null); managed.close(); assertTrue(listener.getClosedSet().contains(managed)); }