testing - Invalid JSON in Playframework 2.1 Test POST Request -



testing - Invalid JSON in Playframework 2.1 Test POST Request -

i trying test post route (on playframework 2.1/ java) , maintain getting bad request - invalid json response.

please allow me know doing wrong. test code below.

running(fakeapplication(), new runnable() { public void run() { map map = new hashmap(); map.put("key1", "val1"); map.put("key2", 2); map.put("key3", true); jsonnode df= json.tojson(map); result result = route (fakerequest(post, "/item").withheader("content-type", "application/json").withsession(accounttest.user_key, "some key") .withsession(accounttest.provider_key, "facebook").withjsonbody(df)); logger.debug("result " + contentasstring(result)); system.out.println("result " + contentasstring(result)); assertthat(result).isnotnull(); // assertthat(result).isnotnull(); // assertthat(result).isequalto("hello"); } });

this documented bug in play 2.1 (java). please refer bug here , git-pull request https://play.lighthouseapp.com/projects/82401/tickets/984-adding-json-body-to-play-21-java-returns-invalid-json-message#ticket-984-8

testing playframework playframework-2.1

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -