@Test public void testFloatingPointInfinity() throws IOException { StubClass stubClass = new StubClass(); stubClass.setF1(Float.POSITIVE_INFINITY); stubClass.setF2(Float.POSITIVE_INFINITY); stubClass.setD1(Double.POSITIVE_INFINITY); stubClass.setD2(Double.POSITIVE_INFINITY); Buffer buffer = new Buffer(); JsonWriter writer = JsonWriter.of(buffer); JsonTelemetryDataSerializer tested = new JsonTelemetryDataSerializer(writer); stubClass.serialize(tested); tested.close(); writer.close(); String str = new String(buffer.readByteArray(), Charsets.UTF_8); System.out.println("[testFloatingPointInfinity] Serialized StubClass: " + str); Gson gson = new Gson(); StubClass bac = gson.fromJson(str, StubClass.class); final double epsilon = Math.ulp(0.0); assertEquals(0, bac.f1, epsilon); assertEquals(0, bac.f2, epsilon); assertEquals(0, bac.d1, epsilon); assertEquals(0, bac.d2, epsilon); }
public void close() throws IOException { out.endObject(); }
JsonTelemetryDataSerializer { public void close() throws IOException { out.endObject(); } }
JsonTelemetryDataSerializer { public void close() throws IOException { out.endObject(); } JsonTelemetryDataSerializer(JsonWriter out); }
JsonTelemetryDataSerializer { public void close() throws IOException { out.endObject(); } JsonTelemetryDataSerializer(JsonWriter out); void reset(JsonWriter out); void close(); void write(String name, Duration value); void write(String name, DataPointType value); void write(String name, int value); void write(String name, com.microsoft.applicationinsights.internal.schemav2.SeverityLevel value); void write(String name, Integer value); void write(String name, double value); void write(String name, Double value); void write(String name, short value); void write(String name, Short value); void write(String name, long value); void write(String name, Long value); void write(String name, boolean value); void write(String name, Boolean value); void write(String name, Date value); void write(String name, String value, int len); void writeRequired(String name, String value, int len); void write(String name, T value); void write(String name, Map<String, T> map); void write(String name, List<T> list); }
JsonTelemetryDataSerializer { public void close() throws IOException { out.endObject(); } JsonTelemetryDataSerializer(JsonWriter out); void reset(JsonWriter out); void close(); void write(String name, Duration value); void write(String name, DataPointType value); void write(String name, int value); void write(String name, com.microsoft.applicationinsights.internal.schemav2.SeverityLevel value); void write(String name, Integer value); void write(String name, double value); void write(String name, Double value); void write(String name, short value); void write(String name, Short value); void write(String name, long value); void write(String name, Long value); void write(String name, boolean value); void write(String name, Boolean value); void write(String name, Date value); void write(String name, String value, int len); void writeRequired(String name, String value, int len); void write(String name, T value); void write(String name, Map<String, T> map); void write(String name, List<T> list);  }