}
@Test
public void testEmptyDataForm() throws MalformedURLException {
DataForm dataForm = new DataForm(DataForm.Type.SUBMIT);
RoomRegistrationForm roomRegistrationForm = new RoomRegistrationForm(dataForm);
roomRegistrationForm.setGivenName("Brunhilde");
DataForm.Field fieldGivenName = dataForm.findField("muc#register_first");
Assert.assertNotNull(fieldGivenName);
Assert.assertEquals(fieldGivenName.getValues().size(), 1);
Assert.assertEquals(fieldGivenName.getValues().get(0), "Brunhilde");
Assert.assertEquals(roomRegistrationForm.getGivenName(), "Brunhilde");
roomRegistrationForm.setFamilyName("Entwhistle-Throckmorton");
DataForm.Field fieldFamilyName = dataForm.findField("muc#register_last");
Assert.assertNotNull(fieldFamilyName);
Assert.assertEquals(fieldFamilyName.getValues().size(), 1);
Assert.assertEquals(fieldFamilyName.getValues().get(0), "Entwhistle-Throckmorton");
Assert.assertEquals(roomRegistrationForm.getFamilyName(), "Entwhistle-Throckmorton");
roomRegistrationForm.setRoomNick("thirdwitch");
DataForm.Field fieldDescription = dataForm.findField("muc#register_roomnick");
Assert.assertNotNull(fieldDescription);
Assert.assertEquals(fieldDescription.getValues().size(), 1);
Assert.assertEquals(fieldDescription.getValues().get(0), "thirdwitch");
Assert.assertEquals(roomRegistrationForm.getRoomNick(), "thirdwitch");
roomRegistrationForm.setWebPage(new URL("http://witchesonline/~hag66/"));
DataForm.Field fieldLanguage = dataForm.findField("muc#register_url");
Assert.assertNotNull(fieldLanguage);
Assert.assertEquals(fieldLanguage.getValues().size(), 1);
Assert.assertEquals(fieldLanguage.getValues().get(0), "http://witchesonline/~hag66/");
Assert.assertEquals(roomRegistrationForm.getWebPage(), new URL("http://witchesonline/~hag66/"));
roomRegistrationForm.setEmail("hag66@witchesonline");
DataForm.Field fieldLdap = dataForm.findField("muc#register_email");
Assert.assertNotNull(fieldLdap);
Assert.assertEquals(fieldLdap.getValues().size(), 1);
Assert.assertEquals(fieldLdap.getValues().get(0), "hag66@witchesonline");
Assert.assertEquals(roomRegistrationForm.getEmail(), "hag66@witchesonline");
roomRegistrationForm.setFaqEntry("Just another witch.");
DataForm.Field fieldLogs = dataForm.findField("muc#register_faqentry");
Assert.assertNotNull(fieldLogs);
Assert.assertEquals(fieldLogs.getValues().size(), 1);
Assert.assertEquals(fieldLogs.getValues().get(0), "Just another witch.");
Assert.assertEquals(roomRegistrationForm.getFaqEntry(), "Just another witch.");
roomRegistrationForm.setRegisterAllowed(true);
DataForm.Field fieldAllow = dataForm.findField("muc#register_allow");
Assert.assertNotNull(fieldAllow);
Assert.assertEquals(fieldAllow.getValues().size(), 1);
Assert.assertEquals(fieldAllow.getValues().get(0), "1");
Assert.assertTrue(roomRegistrationForm.isRegisterAllowed());
}