@ParameterizedTest
  @MethodSource("mappers")
  void javaBean(ObjectMapper mapper) throws IOException {
    JavaBean1 bean1 = new JavaBean1();
    bean1.setString1("id123");
    bean1.setInt1(42);
    bean1.setBase("base1");

    ObjectNode node = mapper.valueToTree(bean1);
    check(ImmutableList.copyOf(node.fieldNames())).has("_id");
    check(node.get("_id").asText()).is("id123");
    check(ImmutableList.copyOf(node.fieldNames())).not().has("string1");

    JavaBean1 bean2 = mapper.treeToValue(node, JavaBean1.class);
    check(bean2.getString1()).is("id123");
    check(bean2.getInt1()).is(42);
    check(bean2.getBase()).is("base1");
  }
Check annotation lookup for java beans
criteria/mongo/test/org/immutables/criteria/mongo/bson4jackson/IdAnnotationModuleTest.java