JacksonUtil { public static String asJsonString(final Object _object) { return JacksonUtil.asJsonString(_object, null, null); }  static String asJsonString(final Object _object); static String asJsonString(
      final Object _object, final Map<Class<?>, StdSerializer<?>> _custom_serializers); @SuppressWarnings({"unchecked", "rawtypes"}) @SuppressFBWarnings( value = "WMI_WRONG_MAP_ITERATOR", justification = "Use of entrySet causes troubles with generics") static String asJsonString(
      final Object _object,
      final Map<Class<?>, StdSerializer<?>> _custom_serializers,
      final Class _view); static Object asObject(final String _json, final Class<?> _clazz); @SuppressWarnings({"unchecked", "rawtypes"}) @SuppressFBWarnings( value = "WMI_WRONG_MAP_ITERATOR", justification = "Use of entrySet causes troubles with generics") static Object asObject(
      final String _json,
      final Map<Class<?>, StdDeserializer<?>> _custom_deserializers,
      final Class<?> _clazz); static Object fromTo(
      final Object _from,
      final Map<Class<?>, StdSerializer<?>> _custom_serializers,
      final Class _view,
      final Class<?> _to);  }
@Test public void testAsJsonString() { final Foo f = new Foo(); final String json_all = JacksonUtil.asJsonString(f); assertEquals("{\"bar\":\"bar\",\"test\":\"test\"}", json_all); }
@Test public void testAsJsonStringWithView() { final Foo f = new Foo(); final String json_all = JacksonUtil.asJsonString(f, null, null); assertEquals("{\"bar\":\"bar\",\"test\":\"test\"}", json_all); final String json_bar = JacksonUtil.asJsonString(f, null, TestViews.DefaultView.class); assertEquals("{\"bar\":\"bar\"}", json_bar); final String json_test = JacksonUtil.asJsonString(f, null, TestViews.TestView.class); assertEquals("{\"bar\":\"bar\",\"test\":\"test\"}", json_all); }
@Test public void testAppAsJsonStringWithView() { final Application app = new Application("com.acme", "foo", "0.1"); final Library lib = new Library("digest-123"); lib.setDigestAlgorithm(DigestAlgorithm.SHA256); final Set<Property> props = new HashSet<Property>(); props.add(new Property(PropertySource.JAVA_MANIFEST, "foo-prop", "bar-prop")); lib.setProperties(props); final Set<ConstructId> cons = new HashSet<ConstructId>(); cons.add(new ConstructId(ProgrammingLanguage.JAVA, ConstructType.METH, "com.foo.Bar")); lib.setConstructs(cons); app.addDependency(new Dependency(app, lib, Scope.COMPILE, false, "fo0-lib.jar", "/tmp/")); final String json_no_view = JacksonUtil.asJsonString(app, null, null); final String json_default_view = JacksonUtil.asJsonString(app, null, Views.Default.class); final String json_lib_view = JacksonUtil.asJsonString(app, null, Views.LibDetails.class); }