| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
|
| 22 |
|
|
| 23 |
|
|
| 24 |
|
|
| 25 |
|
|
| 26 |
|
|
| 27 |
|
|
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
package net.sourceforge.pebble.decorator; |
| 33 |
|
|
| 34 |
|
import java.util.Date; |
| 35 |
|
import net.sourceforge.pebble.domain.BlogEntry; |
| 36 |
|
import net.sourceforge.pebble.domain.Category; |
| 37 |
|
import net.sourceforge.pebble.domain.SingleBlogTestCase; |
| 38 |
|
import net.sourceforge.pebble.api.decorator.ContentDecorator; |
| 39 |
|
import net.sourceforge.pebble.api.decorator.ContentDecoratorContext; |
| 40 |
|
|
| 41 |
|
|
| 42 |
|
|
| 43 |
|
|
| 44 |
|
@author |
| 45 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (32) |
Complexity: 2 |
Complexity Density: 0,07 |
|
| 46 |
|
public class SocialBookmarksDecoratorTest extends SingleBlogTestCase { |
| 47 |
|
|
| 48 |
|
private ContentDecorator decorator; |
| 49 |
|
private BlogEntry blogEntry; |
| 50 |
|
private ContentDecoratorContext context; |
| 51 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0,25 |
|
| 52 |
2
|
protected void setUp() throws Exception {... |
| 53 |
2
|
super.setUp(); |
| 54 |
|
|
| 55 |
2
|
blogEntry = new BlogEntry(blog); |
| 56 |
2
|
decorator = new SocialBookmarksDecorator(); |
| 57 |
2
|
context = new ContentDecoratorContext(); |
| 58 |
|
} |
| 59 |
|
|
| 60 |
|
|
| 61 |
|
|
| 62 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (26) |
Complexity: 1 |
Complexity Density: 0,04 |
1
PASS
|
|
| 63 |
2
|
public void testBlogEntryHasBookmarksAndMediaIsHtml() throws Exception {... |
| 64 |
2
|
Date date = new Date(); |
| 65 |
2
|
long now = 1; |
| 66 |
2
|
date.setTime(now); |
| 67 |
|
|
| 68 |
2
|
blogEntry.setDate(date); |
| 69 |
2
|
blogEntry.setTitle("Bombastic Post Title"); |
| 70 |
2
|
blogEntry.setExcerpt("Excerpt - here is some text"); |
| 71 |
2
|
blogEntry.setBody("Body - here is some text"); |
| 72 |
|
|
| 73 |
2
|
context.setMedia(ContentDecoratorContext.HTML_PAGE); |
| 74 |
2
|
decorator.decorate(context, blogEntry); |
| 75 |
|
|
| 76 |
2
|
StringBuffer bookmarks = new StringBuffer(); |
| 77 |
2
|
bookmarks.append("<div class=\"tags\"><span>Social Bookmarks : </span> "); |
| 78 |
2
|
bookmarks.append("<a href=\"http://slashdot.org/bookmark.pl?url=http://www.yourdomain.com/blog/1970/01/01/1.html&title=Bombastic+Post+Title\" target=\"_blank\" title=\"Add this post to Slash Dot\"><img src=\"common/images/slashdot.png\" alt=\"Add this post to Slashdot\" border=\"0\" /></a> "); |
| 79 |
2
|
bookmarks.append("<a href=\"http://digg.com/submit?url=http://www.yourdomain.com/blog/1970/01/01/1.html&title=Bombastic+Post+Title\" target=\"_blank\" title=\"Digg this post\"><img src=\"common/images/digg.png\" alt=\"Add this post to Digg\" border=\"0\" /></a> "); |
| 80 |
2
|
bookmarks.append("<a href=\"http://reddit.com/submit?url=http://www.yourdomain.com/blog/1970/01/01/1.html&title=Bombastic+Post+Title\" target=\"_blank\" title=\"Add this post to Reddit\"><img src=\"common/images/reddit.png\" alt=\"Add this post to Reddit\" border=\"0\" /></a> "); |
| 81 |
2
|
bookmarks.append("<a href=\"http://del.icio.us/post?url=http://www.yourdomain.com/blog/1970/01/01/1.html&title=Bombastic+Post+Title\" target=\"_blank\" title=\"Save this post to Del.icio.us\"><img src=\"common/images/delicious.png\" alt=\"Add this post to Delicious\" border=\"0\" /></a> "); |
| 82 |
2
|
bookmarks.append("<a href=\"http://www.stumbleupon.com/submit?url=http://www.yourdomain.com/blog/1970/01/01/1.html&title=Bombastic+Post+Title\" target=\"_blank\" title=\"Stumble this post\"><img src=\"common/images/stumbleupon.png\" alt=\"Add this post to Stumble it\" border=\"0\" /></a> "); |
| 83 |
2
|
bookmarks.append("<a href=\"http://www.google.com/bookmarks/mark?op=edit&bkmk=http://www.yourdomain.com/blog/1970/01/01/1.html&title=Bombastic+Post+Title\" target=\"_blank\" title=\"Add this post to Google\"><img src=\"common/images/google.png\" alt=\"Add this post to Google\" border=\"0\" /></a> "); |
| 84 |
2
|
bookmarks.append("<a href=\"http://technorati.com/faves?add=http://www.yourdomain.com/blog/1970/01/01/1.html\" target=\"_blank\" title=\"Add this post to Technorati\"><img src=\"common/images/technorati.png\" alt=\"Add this post to Technorati\" border=\"0\" /></a> "); |
| 85 |
2
|
bookmarks.append("<a href=\"http://www.bloglines.com/sub/http://www.yourdomain.com/blog/1970/01/01/1.html\" target=\"_blank\" title=\"Add this post to Bloglines\"><img src=\"common/images/bloglines.png\" alt=\"Add this post to Bloglines\" border=\"0\" /></a> "); |
| 86 |
2
|
bookmarks.append("<a href=\"http://www.facebook.com/share.php?u=http://www.yourdomain.com/blog/1970/01/01/1.html\" target=\"_blank\" title=\"Add this post to Facebook\"><img src=\"common/images/facebook.png\" alt=\"Add this post to Facebook\" border=\"0\" /></a> "); |
| 87 |
2
|
bookmarks.append("<a href=\"http://www.furl.net/storeIt.jsp?u=http://www.yourdomain.com/blog/1970/01/01/1.html&t=Bombastic+Post+Title\" target=\"_blank\" title=\"Add this post to Furl\"><img src=\"common/images/furl.png\" alt=\"Add this post to Furl\" border=\"0\" /></a> "); |
| 88 |
2
|
bookmarks.append("<a href=\"https://favorites.live.com/quickadd.aspx?mkt=en-us&url=http://www.yourdomain.com/blog/1970/01/01/1.html&title=Bombastic+Post+Title\" target=\"_blank\" title=\"Add this post to Windows Live\"><img src=\"common/images/windowslive.png\" alt=\"Add this post to Windows Live\" border=\"0\" /></a> "); |
| 89 |
2
|
bookmarks.append("<a href=\"http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&u=http://www.yourdomain.com/blog/1970/01/01/1.html&t=Bombastic+Post+Title\" target=\"_blank\" title=\"Add this post to Yahoo!\"><img src=\"common/images/yahoo.png\" alt=\"Add this post to Yahoo!\" border=\"0\" /></a>"); |
| 90 |
2
|
bookmarks.append("</div>"); |
| 91 |
|
|
| 92 |
2
|
assertEquals("Excerpt - here is some text" + bookmarks, blogEntry.getExcerpt()); |
| 93 |
2
|
assertEquals("Body - here is some text" + bookmarks, blogEntry.getBody()); |
| 94 |
|
} |
| 95 |
|
|
| 96 |
|
} |