### Question:
AbstractOutputStreamResource implements SAXVisitBefore, DOMVisitBefore, Consumer, VisitLifecycleCleanable, ExecutionLifecycleCleanable { public abstract OutputStream getOutputStream( final ExecutionContext executionContext ) throws IOException;  abstract OutputStream getOutputStream( final ExecutionContext executionContext ); String getResourceName(); boolean consumes(Object object); AbstractOutputStreamResource setResourceName(String resourceName); AbstractOutputStreamResource setWriterEncoding(Charset writerEncoding); Charset getWriterEncoding(); void visitBefore( final SAXElement element, final ExecutionContext executionContext ); void visitBefore( final Element element, final ExecutionContext executionContext ); void executeVisitLifecycleCleanup(Fragment fragment, ExecutionContext executionContext); void executeExecutionLifecycleCleanup( ExecutionContext executionContext ); static OutputStream getOutputStream(
    		final String resourceName,
            final ExecutionContext executionContext); static Writer getOutputWriter(final String resourceName, final ExecutionContext executionContext);  }### Answer:
@Test public void getOutputStream () throws IOException { AbstractOutputStreamResource resource = new MockAbstractOutputStreamResource(); MockExecutionContext executionContext = new MockExecutionContext(); assertNull(getResource(resource, executionContext)); resource.visitBefore( (Element)null, executionContext ); assertNotNull(getResource(resource, executionContext)); OutputStream outputStream = AbstractOutputStreamResource.getOutputStream( resource.getResourceName(), executionContext); assertNotNull( outputStream ); assertTrue( outputStream instanceof ByteArrayOutputStream ); try { AbstractOutputStreamResource.getOutputWriter( resource.getResourceName(), executionContext); fail("Expected SmooksException"); } catch(SmooksException e) { assertEquals("An OutputStream to the 'Mock' resource is already open. Cannot open a Writer to this resource now!", e.getMessage()); } resource.executeVisitLifecycleCleanup(new Fragment((Element)null), executionContext); assertNull(getResource(resource, executionContext)); assertTrue(MockAbstractOutputStreamResource.isClosed); }