### Question:
SizeUnitRadio extends RadioButton implements RestorableView { @Override public void restoreStateFrom(Map<String, String> data) { Optional.ofNullable(data.get(unit.toString())).map(Boolean::valueOf).ifPresent(this::setSelected); } SizeUnitRadio(SizeUnit unit); @Override void saveStateTo(Map<String, String> data); @Override void restoreStateFrom(Map<String, String> data); SizeUnit unit();  }### Answer:
@Test public void onRestoreState() { SizeUnitRadio victim = new SizeUnitRadio(SizeUnit.MEGABYTE); victim.setSelected(false); Map<String, String> data = new HashMap<>(); data.put(SizeUnit.MEGABYTE.toString(), Boolean.TRUE.toString()); victim.restoreStateFrom(data); assertTrue(victim.isSelected()); }