@Test
  protected void nullable() {
    repository.insert(generator.get().withValue("null").withNullable(null));
    repository.insert(generator.get().withValue("notnull").withNullable("notnull"));

    values(string.nullable.isPresent()).hasContentInAnyOrder("notnull");
    values(string.nullable.isAbsent()).hasContentInAnyOrder("null");
    values(string.nullable.is("null")).isEmpty();
    values(string.nullable.is("")).isEmpty();
    values(string.value.is("null")).hasContentInAnyOrder("null");
    values(string.value.is("notnull")).hasContentInAnyOrder("notnull");

    // using OptionalValue matcher API
    values(string.nullable.is(Optional.empty())).isOf("null");
    values(string.nullable.isNot(Optional.empty())).isOf("notnull");
    values(string.nullable.is(Optional.of("notnull"))).isOf("notnull");
  }
Testing various string operations prefix/suffix/length etc.
criteria/common/test/org/immutables/criteria/typemodel/StringTemplate.java