### Question:
VarExporter implements VariableHost { public void dumpJson(final PrintWriter out) { out.append("{"); visitVariables(new Visitor() { int count = 0; public void visit(Variable var) { if (count++ > 0) { out.append(", "); } out.append(var.getName()).append("='").append(String.valueOf(var.getValue())).append("'"); } }); out.append("}"); } private  VarExporter(@Nullable final String namespace, @Nullable final Class namespaceClass, final boolean declaredFieldsOnly); boolean isDeclaredFieldsOnly(); Class<?> getNamespaceClass(); static synchronized VarExporter forNamespace(String namespace); static synchronized Optional<VarExporter> forNamespaceIfExists(@Nonnull final String namespace); static synchronized VarExporter forNamespace(@Nonnull final Class<?> clazz, final boolean declaredFieldsOnly); static synchronized List<String> getNamespaces(); static VarExporter global(); static void visitNamespaceVariables(String namespace, VariableVisitor visitor); static VariableHost withTag(final String tag); VarExporter includeInGlobal(); VarExporter setParentNamespace(VarExporter namespace); String getNamespace(); VarExporter getParentNamespace(); void export(Object obj, String prefix); void export(Class c, String prefix); void export(Object obj, Member member, String prefix, String name); void export(Class c, Member member, String prefix, String name); void export(LazilyManagedVariable lazilyManagedVariable); void export(ManagedVariable managedVariable); @SuppressWarnings("unchecked") T getValue(final String variableName); @Override @SuppressWarnings("unchecked") Variable<T> getVariable(final String variableName); @Override void visitVariables(VariableVisitor visitor); Iterable<Variable> getVariables(); void dump(final PrintWriter out, final boolean includeDoc); void dumpJson(final PrintWriter out); @SuppressWarnings("unchecked") @VisibleForTesting static void resetGlobal(); @SuppressWarnings("unchecked") @Deprecated void reset();  }### Answer:
@Test public void testDumpJson() { exporter.export(ExampleClass.class, ""); assertExportedNames(exporter, "static1field", "static1method", "myNameIsEarl"); ExampleClass.static1 = 0; StringWriter out = new StringWriter(); exporter.dumpJson(new PrintWriter(out, true)); String dump = out.toString(); assertEquals("{myNameIsEarl='0', static1field='0', static1method='1'}", dump); }