@Test
public void testSingleElementSelect() {
addPageRequest("http://test.com",
newHtml("Test Page", newForm("form").id("form").beginSelect("person").addOption("Peter", "1").addOption("John", "2").addSelectedOption("Susanna", "3").end()));
addPageRequest("http://test.com/form?person=1", newHtml("OK", ""));
AbstractDocument page = agent().get("http://test.com");
Form form = page.forms().find("#form");
Select select = form.findSelect(byIdOrName("person"));
assertFalse(select.isMultiple());
assertEquals(3, select.getOptions().size());
Option peter = select.getOption("Peter");
assertEquals("Peter", peter.getText());
assertEquals("1", peter.getValue());
assertFalse(peter.isSelected());
Option john = select.getOption("John");
assertEquals("John", john.getText());
assertEquals("2", john.getValue());
assertFalse(john.isSelected());
assertTrue(select.getOption("Susanna").isSelected());
peter.select();
assertTrue(peter.isSelected());
assertFalse(john.isSelected());
assertFalse(select.getOption("Susanna").isSelected());
AbstractDocument response = form.submit();
assertEquals("OK", response.getTitle());
}