@Theory
  public void floatNumbersGetAsLong_getsTruncated() throws Exception {
    assertThat(JsonParser.parse("42.0").getAsLong()).isEqualTo(42);
    assertThat(JsonParser.parse("2.1e1").getAsLong()).isEqualTo(21);

    assertThat(JsonParser.parse("42.1").getAsLong()).isEqualTo(42);
    assertThat(JsonParser.parse("42.9999").getAsLong()).isEqualTo(42);

    // 2^63 - 1 as float
    assertThat(JsonParser.parse("9.223372036854775807e18").getAsLong())
        .isEqualTo(9223372036854775807L);

    // - 2^63 as float
    assertThat(JsonParser.parse("-9.223372036854775808e18").getAsLong())
        .isEqualTo(-9223372036854775808L);
  }
Tests for Tink's internal {@link JsonParser}.
java_src/src/test/java/com/google/crypto/tink/internal/JsonParserTest.java