@Test
public void testToFromMap() {

  class Clazz extends AttrComposite {
    public AttrInteger defValue =
        attributes.register("defValue", AttrInteger.builder().defaultValue(42));
    public AttrInteger nullValue =
        attributes.register("nullValue", AttrInteger.builder().defaultValue(null));
    public AttrInteger otherValue =
        attributes.register("otherValue", AttrInteger.builder().defaultValue(null));
  }
  AliasMapper mapper = new AliasMapper();
  mapper.alias("clazz", Clazz.class, () -> new Clazz());
  Clazz ob = new Clazz();
  ob.otherValue.set(24);
  Assertions.assertThat(Attrs.toMap(ob, mapper::toName))
      .containsEntry("defValue", 42)
      .containsEntry("nullValue", null)
      .containsEntry("otherValue", 24);
  Clazz clazz = Attrs.fromMap(Clazz.class, Attrs.toMap(ob, mapper::toName), mapper::fromName);
  Assertions.assertThat(clazz.defValue.get()).isEqualTo(42);
  Assertions.assertThat(clazz.nullValue.get()).isNull();
  Assertions.assertThat(clazz.otherValue.get()).isEqualTo(24);
}