*/
public void testNoFollowAddedToComments() throws Exception {
ContentDecoratorContext context = new ContentDecoratorContext();
context.setView(ContentDecoratorContext.DETAIL_VIEW);
Comment comment1 = blogEntry.createComment("title1", "body1", "author", "email", "website", "avatar", "127.0.0.1");
blogEntry.addComment(comment1);
Comment comment2 = blogEntry.createComment("title2", "body2", "author", "email", "website", "avatar", "127.0.0.1");
blogEntry.addComment(comment2);
comment1.setBody("<p>Here is some body.</p>");
comment2.setBody("<p>Here is some body again.</p>");
decorator.decorate(context, comment1);
decorator.decorate(context, comment2);
assertEquals("<p>Here is some body.</p>", comment1.getBody());
assertEquals("<p>Here is some body again.</p>", comment2.getBody());
comment1.setBody("<p>Here is a <a href=\"http://www.google.com\">a link</a>.</p>");
comment2.setBody("<p>Here is a <a href=http://www.google.com>a link</a> again.</p>");
decorator.decorate(context, comment1);
decorator.decorate(context, comment2);
assertEquals("<p>Here is a <a href=\"http://www.google.com\" rel=\"nofollow\">a link</a>.</p>", comment1.getBody());
assertEquals("<p>Here is a <a href=http://www.google.com rel=\"nofollow\">a link</a> again.</p>", comment2.getBody());
comment1.setBody("<p>Here is a <a href=\"ftp://www.google.com\">a link</a>.</p>");
comment2.setBody("<p>Here is a <a href=\"mailto://www.google.com\">a link</a> again.</p>");
decorator.decorate(context, comment1);
decorator.decorate(context, comment2);
assertEquals("<p>Here is a <a href=\"ftp://www.google.com\" rel=\"nofollow\">a link</a>.</p>", comment1.getBody());
assertEquals("<p>Here is a <a href=\"mailto://www.google.com\" rel=\"nofollow\">a link</a> again.</p>", comment2.getBody());
comment1.setBody("<p>Here is a <a href=\"http://www.google.com\">a link</a> and <a href=\"http://www.yahoo.com\">another</a>.</p>");
comment2.setBody("<p>Here is some body again.</p>");
decorator.decorate(context, comment1);
decorator.decorate(context, comment2);
assertEquals("<p>Here is a <a href=\"http://www.google.com\" rel=\"nofollow\">a link</a> and <a href=\"http://www.yahoo.com\" rel=\"nofollow\">another</a>.</p>", comment1.getBody());
assertEquals("<p>Here is some body again.</p>", comment2.getBody());
// test that we don't add an extra nofollow if one is present already
comment1.setBody("<p>Here is a <a href=\"http://www.google.com\">a link</a> and <a href=\"http://www.yahoo.com\" rel=\"nofollow\">another</a>.</p>");
decorator.decorate(context, comment1);
decorator.decorate(context, comment2);