### Question:
JSONWriter { public String write(Object object) throws JSONException { return this.write(object, null, null, false); }  String write(Object object); String write(Object object, Collection<Pattern> excludeProperties,
                        Collection<Pattern> includeProperties, boolean excludeNullProperties); void setIgnoreHierarchy(boolean ignoreHierarchy); void setEnumAsBean(boolean enumAsBean); static final boolean ENUM_AS_BEAN_DEFAULT; }### Answer:
@Test public void testWrite() throws Exception { Bean bean1=new Bean(); bean1.setStringField("str"); bean1.setBooleanField(true); bean1.setCharField('s'); bean1.setDoubleField(10.1); bean1.setFloatField(1.5f); bean1.setIntField(10); bean1.setLongField(100); bean1.setEnumField(AnEnum.ValueA); bean1.setEnumBean(AnEnumBean.Two); JSONWriter jsonWriter = new JSONWriter(); jsonWriter.setEnumAsBean(false); String json = jsonWriter.write(bean1); TestUtils.assertEquals(JSONWriter.class.getResource("jsonwriter-write-bean-01.txt"), json); }