@Override
  public String toString() {
    var builder = new StringBuilder();
    if (name != null) {
      builder.append("Player: ").append(name).append('\n');
    }

    if (type != null) {
      builder.append("Character type: ").append(type.name()).append('\n');
    }

    builder.append("Stats:\n");
    for (var stat : Stats.values()) {
      var value = this.get(stat);
      if (value == null) {
        continue;
      }
      builder.append(" - ").append(stat.name()).append(':').append(value).append('\n');
    }
    return builder.toString();
  }
@Test
  void testToString() {
    final var prototype = new Character();
    prototype.set(Stats.ARMOR, 1);
    prototype.set(Stats.AGILITY, 2);
    prototype.set(Stats.INTELLECT, 3);
    var message = """
            Stats:
             - AGILITY:2
             - ARMOR:1
             - INTELLECT:3
            """;
    assertEquals(message, prototype.toString());

    final var stupid = new Character(Type.ROGUE, prototype);
    stupid.remove(Stats.INTELLECT);
    String expectedStupidString = """
            Character type: ROGUE
            Stats:
             - AGILITY:2
             - ARMOR:1
            """;
    assertEquals(expectedStupidString, stupid.toString());

    final var weak = new Character("weak", prototype);
    weak.remove(Stats.ARMOR);
    String expectedWeakString = """
            Player: weak
            Stats:
             - AGILITY:2
             - INTELLECT:3
            """;
    assertEquals(expectedWeakString, weak.toString());

  }