### Question:
SizeUnitRadio extends RadioButton implements RestorableView { @Override public void saveStateTo(Map<String, String> data) { if (isSelected()) { data.put(unit.toString(), Boolean.TRUE.toString()); } } SizeUnitRadio(SizeUnit unit); @Override void saveStateTo(Map<String, String> data); @Override void restoreStateFrom(Map<String, String> data); SizeUnit unit();  }### Answer:
@Test public void onSaveState() { SizeUnitRadio victim = new SizeUnitRadio(SizeUnit.KILOBYTE); victim.setSelected(true); Map<String, String> data = new HashMap<>(); victim.saveStateTo(data); assertTrue(Boolean.valueOf(data.get(SizeUnit.KILOBYTE.toString()))); }
@Test public void onSaveStateNotSelected() { SizeUnitRadio victim = new SizeUnitRadio(SizeUnit.MEGABYTE); victim.setSelected(false); Map<String, String> data = new HashMap<>(); victim.saveStateTo(data); assertFalse(Boolean.valueOf(data.get(SizeUnit.MEGABYTE.toString()))); }