/** Tests that the e-mail address is properly escaped and set. */ public void testEmailAddress() { assertEquals("*****@*****.**", comment.getEmail()); // blank or null e-mail defaults to null comment.setEmail(""); assertEquals("", comment.getEmail()); // FIXME should be null comment.setEmail(null); assertEquals("", comment.getEmail()); // FIXME should be null // for security, special HTML characters are removed comment.setEmail("<*****@*****.**>"); assertEquals("<[email protected]>", comment.getEmail()); }
/** Test that a Comment instance can be created correctly. */ public void testConstructionOfSimpleInstance() { assertNotNull(comment); assertEquals("Title", comment.getTitle()); assertEquals("Body", comment.getBody()); assertEquals("Author", comment.getAuthor()); assertEquals("*****@*****.**", comment.getEmail()); assertEquals("http://www.google.com", comment.getWebsite()); assertEquals("http://graph.facebook.com/user/picture", comment.getAvatar()); assertEquals("127.0.0.1", comment.getIpAddress()); assertNotNull(comment.getDate()); assertEquals(comment.getDate().getTime(), comment.getId()); assertNotNull(comment.getBlogEntry()); assertEquals(State.APPROVED, comment.getState()); assertEquals("c/" + comment.getBlogEntry().getId() + "/" + comment.getId(), comment.getGuid()); }