### Question:
Character implements Prototype { public Type type() { return type; } 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 testType() { final Character prototype = new Character(); prototype.set(Stats.ARMOR, 1); prototype.set(Stats.INTELLECT, 2); assertNull(prototype.type()); final Character stupid = new Character(Type.ROGUE, prototype); stupid.remove(Stats.INTELLECT); assertEquals(Type.ROGUE, stupid.type()); final Character weak = new Character("weak", prototype); weak.remove(Stats.ARMOR); assertNull(weak.type()); }
@Test public void testType() { final var prototype = new Character(); prototype.set(Stats.ARMOR, 1); prototype.set(Stats.INTELLECT, 2); assertNull(prototype.type()); final var stupid = new Character(Type.ROGUE, prototype); stupid.remove(Stats.INTELLECT); assertEquals(Type.ROGUE, stupid.type()); final var weak = new Character("weak", prototype); weak.remove(Stats.ARMOR); assertNull(weak.type()); }
@Test public void testType() throws Exception { final Character prototype = new Character(); prototype.set(Stats.ARMOR, 1); prototype.set(Stats.INTELLECT, 2); assertNull(prototype.type()); final Character stupid = new Character(Type.ROGUE, prototype); stupid.remove(Stats.INTELLECT); assertEquals(Type.ROGUE, stupid.type()); final Character weak = new Character("weak", prototype); weak.remove(Stats.ARMOR); assertNull(weak.type()); }