/**
* Tests that a permalink can be generated for a blog entry.
*/
public void testBlogEntryPermalink() throws Exception {
BlogService service = new BlogService();
BlogEntry blogEntry = new BlogEntry(blog);
service.putBlogEntry(blogEntry);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy'/'MM'/'dd'/'");
sdf.setTimeZone(blog.getTimeZone());
String prefix = "/";
prefix += sdf.format(blogEntry.getDate());
String suffix = ".html";
blogEntry.setTitle("Here is a title");
assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));
blogEntry.setTitle("Here's a title");
assertEquals(prefix + "heres_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));
blogEntry.setTitle("Here's a title!");
assertEquals(prefix + "heres_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));
blogEntry.setTitle("Here_is_a_title");
assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));
blogEntry.setTitle("Here-is-a-title");
assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));
blogEntry.setTitle("Here is a title");
assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));
blogEntry.setTitle("Here is : a title");
assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));
blogEntry.setTitle("Here is/a title");
assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));
blogEntry.setTitle("Here is\\a title");
assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));
blogEntry.setTitle("Here is, a title");
assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));
blogEntry.setTitle("Here is; a title");
assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));
blogEntry.setTitle("Here is a title.");
assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));
blogEntry.setTitle(":Here is a title.");
assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));
blogEntry.setTitle("Here is. a title");
assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));
blogEntry.setTitle(null);
assertEquals(prefix + blogEntry.getId() + suffix, permalinkProvider.getPermalink(blogEntry));
blogEntry.setTitle("");
assertEquals(prefix + blogEntry.getId() + suffix, permalinkProvider.getPermalink(blogEntry));
blogEntry.setTitle("./:!@�$%^&*()");
assertEquals(prefix + blogEntry.getId() + suffix, permalinkProvider.getPermalink(blogEntry));
}