@Test
  public void exceptions() throws IOException {
    try {
      Jsons.readerAt(new BsonBoolean(true)).nextInt();
      Assert.fail("didn't fail");
    } catch (IllegalStateException ignore) {
    }

    try {
      Jsons.readerAt(BsonNull.VALUE).nextInt();
      Assert.fail("didn't fail");
    } catch (IllegalStateException ignore) {
    }

  }
Validate type conversion between BSON and gson-JSON ({@link com.google.gson.stream.JsonToken}).
mongo/test/org/immutables/mongo/bson4gson/TypeConversionTest.java