@Test public void shouldCorrectlyWriteBsonObjectWithNestedObjectValue() { BasicDocument address = new BasicDocument(); address.put("street", "100 Main St."); address.put("city", "Springfield"); BasicDocument top = new BasicDocument(); top.put("firstName", "Jack"); top.put("lastName", "Riley"); top.put("address", address); String actual = writer.write(top); String expected = "{ \"firstName\" : \"Jack\" , \"lastName\" : \"Riley\" , \"address\" : { \"street\" : \"100 Main St.\" , \"city\" : \"Springfield\" } }"; assertSame(expected, actual); }
@Override public void write( Object object, OutputStream stream ) throws IOException { Writer writer = new BufferedWriter(new OutputStreamWriter(stream, Json.UTF8)); write(object, writer); writer.flush(); }
CompactJsonWriter implements JsonWriter { @Override public void write( Object object, OutputStream stream ) throws IOException { Writer writer = new BufferedWriter(new OutputStreamWriter(stream, Json.UTF8)); write(object, writer); writer.flush(); } }
CompactJsonWriter implements JsonWriter { @Override public void write( Object object, OutputStream stream ) throws IOException { Writer writer = new BufferedWriter(new OutputStreamWriter(stream, Json.UTF8)); write(object, writer); writer.flush(); }  }
CompactJsonWriter implements JsonWriter { @Override public void write( Object object, OutputStream stream ) throws IOException { Writer writer = new BufferedWriter(new OutputStreamWriter(stream, Json.UTF8)); write(object, writer); writer.flush(); }  @Override void write( Object object,
                       OutputStream stream ); @Override void write( Object object,
                       Writer writer ); @Override void write( Object object,
                       StringBuilder writer ); @Override String write( Object object ); }
CompactJsonWriter implements JsonWriter { @Override public void write( Object object, OutputStream stream ) throws IOException { Writer writer = new BufferedWriter(new OutputStreamWriter(stream, Json.UTF8)); write(object, writer); writer.flush(); }  @Override void write( Object object,
                       OutputStream stream ); @Override void write( Object object,
                       Writer writer ); @Override void write( Object object,
                       StringBuilder writer ); @Override String write( Object object );  }