### Question:
SingleThreadJsonFactory extends JsonFactory { @Override protected OutputStream _createDataOutputWrapper(DataOutput out) { dataOutputDelegate.setDelegate(out); return dataOutputDelegate; } SingleThreadJsonFactory();  SingleThreadJsonFactory(SingleThreadJsonFactory factory, ObjectCodec codec); @Override JsonGenerator createGenerator(Writer w); @Override JsonGenerator createGenerator(File f, JsonEncoding enc); @Override JsonGenerator createGenerator(OutputStream out, JsonEncoding enc); @Override final JsonFactory setCharacterEscapes(CharacterEscapes esc); @Override JsonFactory setRootValueSeparator(String sep); @Override SingleThreadJsonFactory copy();  }### Answer:
@Test public void createDataOutputWrapperCallsReplacesDelegateTarget() { SingleThreadJsonFactory factory = new SingleThreadJsonFactory(); DataOutput dataOutput1 = mock(DataOutput.class); factory._createDataOutputWrapper(dataOutput1); assertSame(factory.dataOutputDelegate.getDelegate(), dataOutput1); DataOutput dataOutput2 = mock(DataOutput.class); factory._createDataOutputWrapper(dataOutput2); assertSame(factory.dataOutputDelegate.getDelegate(), dataOutput2); }
@Test public void createDataOutputWrapperCallsReturnSameInstanceEveryTime() { SingleThreadJsonFactory factory = new SingleThreadJsonFactory(); DataOutput dataOutput1 = mock(DataOutput.class); OutputStream outputStream1 = factory._createDataOutputWrapper(dataOutput1); DataOutput dataOutput2 = mock(DataOutput.class); OutputStream outputStream2 = factory._createDataOutputWrapper(dataOutput2); assertSame(outputStream1, outputStream2); }