@Nullable static String getNonEmptyBsonString(BsonValue bsonValue) {
    if (bsonValue == null || !bsonValue.isString()) return null;
    String stringValue = bsonValue.asString().getValue().trim();
    return stringValue.isEmpty() ? null : stringValue;
  }
@Test void getNonEmptyBsonString_notString() {
    assertThat(getNonEmptyBsonString(BsonBoolean.TRUE)).isNull();
  }