### Question:
ServerBlob extends UnicastExportable implements RemoteBlob { @Override public RemoteOutputStream openOutputStream(long estimatedSize, boolean overwrite) throws IOException { return new ServerOutputStream(blob.openOutputStream(estimatedSize, overwrite), getExporter()); } ServerBlob(Blob blob, Exporter exporter); @Override URI getId(); @Override URI getCanonicalId(); @Override boolean exists(); @Override long getSize(); @Override void delete(); @Override RemoteBlob moveTo(URI other, Map<String, String> hints); @Override RemoteInputStream openInputStream(); @Override RemoteOutputStream openOutputStream(long estimatedSize, boolean overwrite);  }### Answer:
@Test public void testOpenOutputStream() throws IOException { URI id = URI.create("foo:bar"); OutputStream out = createMock(OutputStream.class); reset(blob); expect(blob.openOutputStream(42L, true)).andReturn(out); expect(blob.openOutputStream(-1L, true)).andThrow(new MissingBlobException(id)); replay(blob); RemoteOutputStream ro = sb.openOutputStream(42L, true); assertTrue(ro instanceof ServerOutputStream); assertEquals(((ServerOutputStream) ro).getOutputStream(), out); try { sb.openOutputStream(-1L, true); fail("Failed to rcv expected exception"); } catch (MissingBlobException e) { assertEquals(id, e.getBlobId()); } verify(blob); }