### Question:
Character implements Prototype { @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(); } Character();  Character(Type type, Prototype prototype);  Character(String name, Character prototype); String name(); Type type(); @Override Integer get(Stats stat); @Override boolean has(Stats stat); @Override void set(Stats stat, Integer val); @Override void remove(Stats stat); @Override String toString();  }### Answer:
@Test public void testToString() { final var prototype = new Character(); prototype.set(Stats.ARMOR, 1); prototype.set(Stats.AGILITY, 2); prototype.set(Stats.INTELLECT, 3); assertEquals("Stats:\n - AGILITY:2\n - ARMOR:1\n - INTELLECT:3\n", prototype.toString()); final var stupid = new Character(Type.ROGUE, prototype); stupid.remove(Stats.INTELLECT); assertEquals("Character type: ROGUE\nStats:\n - AGILITY:2\n - ARMOR:1\n", stupid.toString()); final var weak = new Character("weak", prototype); weak.remove(Stats.ARMOR); assertEquals("Player: weak\nStats:\n - AGILITY:2\n - INTELLECT:3\n", weak.toString()); }