### Question:
SoldierUnit extends Unit { @Override public UnitExtension getUnitExtension(String extensionName) { if (extensionName.equals("SoldierExtension")) { return Optional.ofNullable(unitExtension).orElseGet(() -> new Soldier(this)); } return super.getUnitExtension(extensionName); } SoldierUnit(String name); @Override UnitExtension getUnitExtension(String extensionName);  }### Answer:
@Test public void getUnitExtension() { final var unit = new SoldierUnit("SoldierUnitName"); assertNotNull(unit.getUnitExtension("SoldierExtension")); assertNull(unit.getUnitExtension("SergeantExtension")); assertNull(unit.getUnitExtension("CommanderExtension")); }