Search in sources :

Example 41 with JsonObject

use of dontweave.gson.JsonObject in project h2o-2 by h2oai.

the class AutoBuffer2JSONTest method testFloatFromRequest.

//---- Only Request1 tests
@Test
public void testFloatFromRequest() {
    JsonObject o = new JsonObject();
    o.addProperty("f1", Float.NaN);
    o.addProperty("f2", Float.POSITIVE_INFINITY);
    o.addProperty("f3", Float.NEGATIVE_INFINITY);
    o.addProperty("f4", 3.141527f);
    o = JsonUtil.escape(o);
    Assert.assertEquals("{\"f1\":\"NaN\",\"f2\":\"Infinity\",\"f3\":\"-Infinity\",\"f4\":3.141527}", o.toString());
}
Also used : JsonObject(dontweave.gson.JsonObject)

Aggregations

JsonObject (dontweave.gson.JsonObject)41 JsonElement (dontweave.gson.JsonElement)5 JsonParser (dontweave.gson.JsonParser)4 JsonArray (dontweave.gson.JsonArray)3 Frame (water.fvec.Frame)3 Job (water.Job)2 Value (water.Value)2 JsonPrimitive (dontweave.gson.JsonPrimitive)1 JsonWriter (dontweave.gson.stream.JsonWriter)1 FileWriter (java.io.FileWriter)1 InputStreamReader (java.io.InputStreamReader)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 Date (java.util.Date)1 TimerTask (java.util.TimerTask)1 HttpClient (org.apache.commons.httpclient.HttpClient)1 GetMethod (org.apache.commons.httpclient.methods.GetMethod)1 Path (org.apache.hadoop.fs.Path)1 Key (water.Key)1 Timer (water.Timer)1 FrameSummary (water.api.Frames.FrameSummary)1