WizardPage extends JPanel { public void updateSettings(WizardSettings settings){ for (Component c : _namedComponents){ settings.put(c.getName(), getValue(c)); } } WizardPage(String title, String description); final String getId(); String getTitle(); String getDescription(); void updateSettings(WizardSettings settings); void rendering(List<WizardPage> path, WizardSettings settings); @Override String toString(); boolean onNext(WizardSettings settings); boolean onPrev(WizardSettings settings); WizardController getController();  }
@Test public void testUpdateSettings_keysExist() { WizardPage page = new TestWizardPage("Test Page",""); WizardSettings settings = new StackWizardSettings(); page.updateSettings(settings); Assert.assertTrue("Key set did not contain needed key.", settings.keySet().contains("test box")); Assert.assertTrue("Key set did not contain needed key.", settings.keySet().contains("test field")); Assert.assertTrue("Key set did not contain needed key.", settings.keySet().contains("custom comp")); Assert.assertTrue("Key set did not contain needed key.", settings.keySet().contains("formated field")); }
@Test public void testUpdateSettings_getValues() { WizardPage page = new TestWizardPage("Test Page",""); WizardSettings settings = new StackWizardSettings(); page.updateSettings(settings); boolean checkVal = (Boolean)settings.get("test box"); Assert.assertEquals("Wrong value.", false, checkVal); String fieldVal = (String)settings.get("test field"); Assert.assertEquals("Wrong value.", "some text", fieldVal); String ctcValue = (String)settings.get("custom comp"); Assert.assertEquals("Wrong value.", "sample value", ctcValue); Long formatVal = (Long)settings.get("formated field"); Assert.assertEquals("Wrong value.", Long.valueOf(42l), formatVal); }