@Test public void testJsonLogic() throws ScriptException, NoSuchMethodException { assertTrue("jsonLogic.apply( { \"==\" : [1, 1] } );"); assertFalse("jsonLogic.apply( { \"==\" : [1, 0] } );"); Assert.assertTrue(JsonLogic.apply("{ \"==\" : [1, 1] }")); Assert.assertFalse(JsonLogic.apply("{ \"==\" : [1, 0] }")); assertTrue("jsonLogic.apply(\n" + " {\"and\" : [\n" + " { \">\" : [3,1] },\n" + " { \"<\" : [1,3] }\n" + " ] }\n" + ");"); }
private JsonLogic() { ScriptEngineManager factory = new ScriptEngineManager(); engine = factory.getEngineByName("nashorn"); Preconditions.checkNotNull(engine); loadScript("json_logic.js"); }
JsonLogic { private JsonLogic() { ScriptEngineManager factory = new ScriptEngineManager(); engine = factory.getEngineByName("nashorn"); Preconditions.checkNotNull(engine); loadScript("json_logic.js"); } }
JsonLogic { private JsonLogic() { ScriptEngineManager factory = new ScriptEngineManager(); engine = factory.getEngineByName("nashorn"); Preconditions.checkNotNull(engine); loadScript("json_logic.js"); } private  JsonLogic(); }
JsonLogic { private JsonLogic() { ScriptEngineManager factory = new ScriptEngineManager(); engine = factory.getEngineByName("nashorn"); Preconditions.checkNotNull(engine); loadScript("json_logic.js"); } private  JsonLogic(); static JsonLogic getInstance(); ScriptEngine getEngine(); Invocable getInvocable(); static Object eval(String script); static Object invokeFunction(String name, Object... args); static boolean apply(String rule); static boolean apply(String rule, String data); static Object applyObject(String rule); static Object applyObject(String rule, String data); }
JsonLogic { private JsonLogic() { ScriptEngineManager factory = new ScriptEngineManager(); engine = factory.getEngineByName("nashorn"); Preconditions.checkNotNull(engine); loadScript("json_logic.js"); } private  JsonLogic(); static JsonLogic getInstance(); ScriptEngine getEngine(); Invocable getInvocable(); static Object eval(String script); static Object invokeFunction(String name, Object... args); static boolean apply(String rule); static boolean apply(String rule, String data); static Object applyObject(String rule); static Object applyObject(String rule, String data);  }