Jsonya { public static Navigator<MutableMap<Object,Object>> newInstance() { return new Navigator<MutableMap<Object,Object>>(MutableMap.class); } private  Jsonya(); static Navigator<T> of(T map); static Navigator<T> of(Navigator<T> navigator); static Navigator<MutableMap<Object,Object>> newInstance(); static Navigator<MutableMap<Object,Object>> at(Object ...pathSegments); static Navigator<MutableMap<Object,Object>> newInstanceTranslating(Function<Object,Object> translator); static Navigator<MutableMap<Object,Object>> newInstanceLiteral(); static Navigator<MutableMap<Object,Object>> newInstancePrimitive(); static Object convertToJsonPrimitive(Object x); static boolean isJsonPrimitiveCompatible(Object x); static String render(Object focus);  }
@Test public void testAddStringToRoot() { Navigator<MutableMap<Object, Object>> j = Jsonya.newInstance().add("a"); Assert.assertEquals( j.toString(), "\"a\""); Assert.assertEquals( j.get(), "a"); }
@Test public void testAddStringsAtRootDefaultsToMap() { Navigator<MutableMap<Object, Object>> j = Jsonya.newInstance().add("a", 1); Assert.assertEquals( j.toString(), "{ \"a\": 1 }"); }
@Test public void testAddOddStringsAtRootIsError() { try { Jsonya.newInstance().add("a", 1, "b"); Asserts.shouldHaveFailedPreviously(); } catch (Exception e) { Asserts.expectedFailureContainsIgnoreCase(e, "odd"); } }