| 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.domain; |
| 33 |
|
|
| 34 |
|
import net.sourceforge.pebble.api.event.comment.CommentEvent; |
| 35 |
|
import net.sourceforge.pebble.api.event.comment.CommentListener; |
| 36 |
|
|
| 37 |
|
import java.util.Calendar; |
| 38 |
|
import java.util.Date; |
| 39 |
|
|
| 40 |
|
|
| 41 |
|
|
| 42 |
|
|
| 43 |
|
@author |
| 44 |
|
|
|
|
|
| 80,5% |
Uncovered Elements: 39 (200) |
Complexity: 36 |
Complexity Density: 0,22 |
|
| 45 |
|
public class CommentTest extends SingleBlogTestCase { |
| 46 |
|
|
| 47 |
|
private BlogEntry blogEntry; |
| 48 |
|
private Comment comment; |
| 49 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0,25 |
|
| 50 |
36
|
protected void setUp() throws Exception {... |
| 51 |
36
|
super.setUp(); |
| 52 |
|
|
| 53 |
36
|
blogEntry = new BlogEntry(blog); |
| 54 |
36
|
comment = blogEntry.createComment("Title", "Body", "Author", "me@somedomain.com", "http://www.google.com", "127.0.0.1"); |
| 55 |
36
|
comment.setEventsEnabled(true); |
| 56 |
|
} |
| 57 |
|
|
| 58 |
|
|
| 59 |
|
|
| 60 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 1 |
Complexity Density: 0,08 |
1
PASS
|
|
| 61 |
2
|
public void testConstructionOfSimpleInstance() {... |
| 62 |
2
|
assertNotNull(comment); |
| 63 |
2
|
assertEquals("Title", comment.getTitle()); |
| 64 |
2
|
assertEquals("Body", comment.getBody()); |
| 65 |
2
|
assertEquals("Author", comment.getAuthor()); |
| 66 |
2
|
assertEquals("me@somedomain.com", comment.getEmail()); |
| 67 |
2
|
assertEquals("http://www.google.com", comment.getWebsite()); |
| 68 |
2
|
assertEquals("127.0.0.1", comment.getIpAddress()); |
| 69 |
2
|
assertNotNull(comment.getDate()); |
| 70 |
2
|
assertEquals(comment.getDate().getTime(), comment.getId()); |
| 71 |
2
|
assertNotNull(comment.getBlogEntry()); |
| 72 |
2
|
assertEquals(State.APPROVED, comment.getState()); |
| 73 |
2
|
assertEquals("c/" + comment.getBlogEntry().getId() + "/" + comment.getId(), comment.getGuid()); |
| 74 |
|
} |
| 75 |
|
|
| 76 |
|
|
| 77 |
|
|
| 78 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0,14 |
1
PASS
|
|
| 79 |
2
|
public void testAuthor() {... |
| 80 |
2
|
assertEquals("Author", comment.getAuthor()); |
| 81 |
|
|
| 82 |
|
|
| 83 |
2
|
comment.setAuthor(""); |
| 84 |
2
|
assertEquals("Anonymous", comment.getAuthor()); |
| 85 |
2
|
comment.setAuthor(null); |
| 86 |
2
|
assertEquals("Anonymous", comment.getAuthor()); |
| 87 |
|
|
| 88 |
|
|
| 89 |
|
|
| 90 |
2
|
comment.setAuthor("<Author>"); |
| 91 |
2
|
assertEquals("<Author>", comment.getAuthor()); |
| 92 |
|
} |
| 93 |
|
|
| 94 |
|
|
| 95 |
|
|
| 96 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0,14 |
1
PASS
|
|
| 97 |
2
|
public void testEmailAddress() {... |
| 98 |
2
|
assertEquals("me@somedomain.com", comment.getEmail()); |
| 99 |
|
|
| 100 |
|
|
| 101 |
2
|
comment.setEmail(""); |
| 102 |
2
|
assertEquals(null, comment.getEmail()); |
| 103 |
2
|
comment.setEmail(null); |
| 104 |
2
|
assertEquals(null, comment.getEmail()); |
| 105 |
|
|
| 106 |
|
|
| 107 |
2
|
comment.setEmail("<me@somedomain.com>"); |
| 108 |
2
|
assertEquals("<me@somedomain.com>", comment.getEmail()); |
| 109 |
|
} |
| 110 |
|
|
| 111 |
|
|
| 112 |
|
|
| 113 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (17) |
Complexity: 1 |
Complexity Density: 0,06 |
1
PASS
|
|
| 114 |
2
|
public void testWebsite() {... |
| 115 |
2
|
assertEquals("http://www.google.com", comment.getWebsite()); |
| 116 |
|
|
| 117 |
|
|
| 118 |
2
|
comment.setWebsite(""); |
| 119 |
2
|
assertEquals(null, comment.getWebsite()); |
| 120 |
2
|
comment.setWebsite(null); |
| 121 |
2
|
assertEquals(null, comment.getWebsite()); |
| 122 |
|
|
| 123 |
|
|
| 124 |
2
|
comment.setWebsite("<script>http://www.google.com"); |
| 125 |
2
|
assertEquals("http://www.google.com", comment.getWebsite()); |
| 126 |
|
|
| 127 |
|
|
| 128 |
|
|
| 129 |
2
|
comment.setWebsite("http://www.google.com"); |
| 130 |
2
|
assertEquals("http://www.google.com", comment.getWebsite()); |
| 131 |
2
|
comment.setWebsite("https://www.google.com"); |
| 132 |
2
|
assertEquals("https://www.google.com", comment.getWebsite()); |
| 133 |
2
|
comment.setWebsite("ftp://www.google.com"); |
| 134 |
2
|
assertEquals("ftp://www.google.com", comment.getWebsite()); |
| 135 |
2
|
comment.setWebsite("mailto://www.google.com"); |
| 136 |
2
|
assertEquals("mailto://www.google.com", comment.getWebsite()); |
| 137 |
2
|
comment.setWebsite("www.google.com"); |
| 138 |
2
|
assertEquals("http://www.google.com", comment.getWebsite()); |
| 139 |
|
} |
| 140 |
|
|
| 141 |
|
|
| 142 |
|
|
| 143 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0,17 |
1
PASS
|
|
| 144 |
2
|
public void testBody() {... |
| 145 |
2
|
comment.setBody(""); |
| 146 |
2
|
assertEquals(null, comment.getBody()); |
| 147 |
2
|
comment.setBody(null); |
| 148 |
2
|
assertEquals(null, comment.getBody()); |
| 149 |
|
|
| 150 |
2
|
comment.setBody("Here is some text"); |
| 151 |
2
|
assertEquals("Here is some text", comment.getBody()); |
| 152 |
|
} |
| 153 |
|
|
| 154 |
|
|
| 155 |
|
|
| 156 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
1
PASS
|
|
| 157 |
2
|
public void testDate() {... |
| 158 |
2
|
assertNotNull(comment.getDate()); |
| 159 |
|
|
| 160 |
2
|
comment.setDate(new Date()); |
| 161 |
2
|
assertNotNull(comment.getDate()); |
| 162 |
|
|
| 163 |
2
|
comment.setDate(null); |
| 164 |
2
|
assertNotNull(comment.getDate()); |
| 165 |
|
} |
| 166 |
|
|
| 167 |
|
|
| 168 |
|
|
| 169 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0,17 |
1
PASS
|
|
| 170 |
2
|
public void testTitleTakenFromOwningBlogEntryWhenNotSpecified() {... |
| 171 |
2
|
BlogEntry entry = new BlogEntry(blog); |
| 172 |
2
|
entry.setTitle("My blog entry title"); |
| 173 |
2
|
comment = entry.createComment(null, "", "", "", "", ""); |
| 174 |
2
|
assertEquals("Re: My blog entry title", comment.getTitle()); |
| 175 |
2
|
comment = entry.createComment("", "", "", "", "", ""); |
| 176 |
2
|
assertEquals("Re: My blog entry title", comment.getTitle()); |
| 177 |
|
} |
| 178 |
|
|
| 179 |
|
|
| 180 |
|
|
| 181 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
| 182 |
2
|
public void testNumberOfParentsIsZeroByDefault() {... |
| 183 |
2
|
assertEquals(0, comment.getNumberOfParents()); |
| 184 |
|
} |
| 185 |
|
|
| 186 |
|
|
| 187 |
|
|
| 188 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
1
PASS
|
|
| 189 |
2
|
public void testNumberOfParentsIsCorrectWhenNested() {... |
| 190 |
2
|
comment.setParent(new BlogEntry(blog).createComment("", "", "", "", "", "")); |
| 191 |
2
|
assertEquals(1, comment.getNumberOfParents()); |
| 192 |
|
} |
| 193 |
|
|
| 194 |
|
|
| 195 |
|
|
| 196 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
| 197 |
2
|
public void testAddingNullCommentDoesntCauseException() {... |
| 198 |
2
|
comment.addComment(null); |
| 199 |
|
} |
| 200 |
|
|
| 201 |
|
|
| 202 |
|
|
| 203 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
| 204 |
2
|
public void testRemovingNullCommentDoesntCauseException() {... |
| 205 |
2
|
comment.removeComment(null); |
| 206 |
|
} |
| 207 |
|
|
| 208 |
|
|
| 209 |
|
|
| 210 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0,06 |
1
PASS
|
|
| 211 |
2
|
public void testTruncatedBody() {... |
| 212 |
2
|
comment.setBody(null); |
| 213 |
2
|
assertEquals("", comment.getTruncatedBody()); |
| 214 |
|
|
| 215 |
2
|
comment.setBody("1234567890"); |
| 216 |
2
|
assertEquals("1234567890", comment.getTruncatedBody()); |
| 217 |
|
|
| 218 |
2
|
comment.setBody("Here is <b>some</b> <i>HTML</i>."); |
| 219 |
2
|
assertEquals("Here is some HTML.", comment.getTruncatedBody()); |
| 220 |
|
|
| 221 |
2
|
comment.setBody("Here is <some> text."); |
| 222 |
2
|
assertEquals("Here is some text.", comment.getTruncatedBody()); |
| 223 |
|
|
| 224 |
2
|
comment.setBody("1234567890123456789012345678901234567890123456789012345678901234567890"); |
| 225 |
2
|
assertEquals("12345678901234567890...", comment.getTruncatedBody()); |
| 226 |
|
|
| 227 |
2
|
comment.setBody("1234567890 123456789012345678901234567890123456789012345678901234567890"); |
| 228 |
2
|
assertEquals("1234567890 12345678901234567890...", comment.getTruncatedBody()); |
| 229 |
|
|
| 230 |
2
|
comment.setBody("<p>" + |
| 231 |
|
"You can grab the source for Pebble 1.6 by doing the following:<pre> cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/pebble login \n" + |
| 232 |
|
" cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/pebble checkout -r v1_6_0 pebble</pre>\n" + |
| 233 |
|
"When prompted for a password, just press enter (there is no password).\n" + |
| 234 |
|
"</p>"); |
| 235 |
2
|
assertEquals("You can grab the source for Pebble 1.6 by doing the following: cvs -d:pserver:anonymous...", comment.getTruncatedBody()); |
| 236 |
|
|
| 237 |
2
|
comment.setBody("<p>" + |
| 238 |
|
"123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 " + |
| 239 |
|
"123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 " + |
| 240 |
|
"123456789 123456789 123456789 123456789 12345678Wünsche"); |
| 241 |
2
|
assertEquals("123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 ...", comment.getTruncatedBody()); |
| 242 |
|
} |
| 243 |
|
|
| 244 |
|
|
| 245 |
|
|
| 246 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 1 |
Complexity Density: 0,09 |
1
PASS
|
|
| 247 |
2
|
public void testClone() {... |
| 248 |
2
|
Comment clonedComment = (Comment)comment.clone(); |
| 249 |
|
|
| 250 |
2
|
assertEquals(comment.getTitle(), clonedComment.getTitle()); |
| 251 |
2
|
assertEquals(comment.getBody(), clonedComment.getBody()); |
| 252 |
2
|
assertEquals(comment.getWebsite(), clonedComment.getWebsite()); |
| 253 |
2
|
assertEquals(comment.getAuthor(), clonedComment.getAuthor()); |
| 254 |
2
|
assertEquals(comment.getIpAddress(), clonedComment.getIpAddress()); |
| 255 |
2
|
assertEquals(comment.getDate(), clonedComment.getDate()); |
| 256 |
2
|
assertEquals(comment.getId(), clonedComment.getId()); |
| 257 |
2
|
assertEquals(comment.getState(), clonedComment.getState()); |
| 258 |
2
|
assertEquals(comment.getParent(), clonedComment.getParent()); |
| 259 |
2
|
assertEquals(comment.getBlogEntry(), clonedComment.getBlogEntry()); |
| 260 |
|
} |
| 261 |
|
|
| 262 |
|
|
| 263 |
|
|
| 264 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
1
PASS
|
|
| 265 |
2
|
public void testEquals() {... |
| 266 |
2
|
assertTrue(comment.equals(comment)); |
| 267 |
|
|
| 268 |
2
|
Calendar cal = blog.getCalendar(); |
| 269 |
2
|
cal.set(Calendar.YEAR, cal.get(Calendar.YEAR)-1); |
| 270 |
2
|
Comment comment2 = new BlogEntry(blog).createComment("Title", "Body", "Author", "me@somedomain.com", "http://www.google.com", "127.0.0.1", cal.getTime(), State.APPROVED); |
| 271 |
2
|
assertFalse(comment.equals(comment2)); |
| 272 |
|
|
| 273 |
|
} |
| 274 |
|
|
| 275 |
|
|
| 276 |
|
|
| 277 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 1 |
Complexity Density: 0,07 |
1
PASS
|
|
| 278 |
2
|
public void testStates() {... |
| 279 |
|
|
| 280 |
2
|
assertEquals(State.APPROVED, comment.getState()); |
| 281 |
2
|
assertTrue(comment.isApproved()); |
| 282 |
2
|
assertFalse(comment.isPending()); |
| 283 |
2
|
assertFalse(comment.isRejected()); |
| 284 |
|
|
| 285 |
2
|
comment.setPending(); |
| 286 |
2
|
assertEquals(State.PENDING, comment.getState()); |
| 287 |
2
|
assertFalse(comment.isApproved()); |
| 288 |
2
|
assertTrue(comment.isPending()); |
| 289 |
2
|
assertFalse(comment.isRejected()); |
| 290 |
|
|
| 291 |
2
|
comment.setRejected(); |
| 292 |
2
|
assertEquals(State.REJECTED, comment.getState()); |
| 293 |
2
|
assertFalse(comment.isApproved()); |
| 294 |
2
|
assertFalse(comment.isPending()); |
| 295 |
2
|
assertTrue(comment.isRejected()); |
| 296 |
|
} |
| 297 |
|
|
| 298 |
|
|
| 299 |
|
|
| 300 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0,33 |
1
PASS
|
|
| 301 |
2
|
public void testListenersFiredWhenCommentMarkedAsPending() {... |
| 302 |
|
|
| 303 |
2
|
CommentListener listener = new CommentListener() { |
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 304 |
0
|
public void commentAdded(CommentEvent event) {... |
| 305 |
0
|
fail(); |
| 306 |
|
} |
| 307 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 308 |
0
|
public void commentRemoved(CommentEvent event) {... |
| 309 |
0
|
fail(); |
| 310 |
|
} |
| 311 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 312 |
0
|
public void commentApproved(CommentEvent event) {... |
| 313 |
0
|
fail(); |
| 314 |
|
} |
| 315 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 316 |
0
|
public void commentRejected(CommentEvent event) {... |
| 317 |
0
|
fail(); |
| 318 |
|
} |
| 319 |
|
}; |
| 320 |
|
|
| 321 |
2
|
blog.getEventListenerList().addCommentListener(listener); |
| 322 |
2
|
comment.setPending(); |
| 323 |
|
} |
| 324 |
|
|
| 325 |
|
|
| 326 |
|
|
| 327 |
|
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0,17 |
|
| 328 |
0
|
public void commentEventCanBeVetoed() {... |
| 329 |
|
|
| 330 |
|
|
| 331 |
|
|
| 332 |
0
|
comment.setPending(); |
| 333 |
|
|
| 334 |
0
|
CommentListener listener1 = new CommentListener() { |
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 335 |
0
|
public void commentAdded(CommentEvent event) {... |
| 336 |
0
|
fail(); |
| 337 |
|
} |
| 338 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 339 |
0
|
public void commentRemoved(CommentEvent event) {... |
| 340 |
0
|
fail(); |
| 341 |
|
} |
| 342 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 343 |
0
|
public void commentApproved(CommentEvent event) {... |
| 344 |
0
|
event.veto(); |
| 345 |
|
} |
| 346 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 347 |
0
|
public void commentRejected(CommentEvent event) {... |
| 348 |
0
|
fail(); |
| 349 |
|
} |
| 350 |
|
}; |
| 351 |
|
|
| 352 |
0
|
CommentListener listener2 = new CommentListener() { |
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 353 |
0
|
public void commentAdded(CommentEvent event) {... |
| 354 |
0
|
fail(); |
| 355 |
|
} |
| 356 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 357 |
0
|
public void commentRemoved(CommentEvent event) {... |
| 358 |
0
|
fail(); |
| 359 |
|
} |
| 360 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 361 |
0
|
public void commentApproved(CommentEvent event) {... |
| 362 |
0
|
fail(); |
| 363 |
|
} |
| 364 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 365 |
0
|
public void commentRejected(CommentEvent event) {... |
| 366 |
0
|
fail(); |
| 367 |
|
} |
| 368 |
|
}; |
| 369 |
|
|
| 370 |
0
|
blog.getEventListenerList().addCommentListener(listener1); |
| 371 |
0
|
blog.getEventListenerList().addCommentListener(listener2); |
| 372 |
|
|
| 373 |
0
|
comment.setApproved(); |
| 374 |
|
} |
| 375 |
|
|
| 376 |
|
|
| 377 |
|
|
| 378 |
|
|
| 379 |
|
|
| 380 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
1
PASS
|
|
| 381 |
2
|
public void testListenersNotFiredWhenCommentApprovedOnClone() {... |
| 382 |
2
|
comment.setPending(); |
| 383 |
2
|
comment = (Comment)comment.clone(); |
| 384 |
|
|
| 385 |
2
|
CommentListener listener = new CommentListener() { |
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 386 |
0
|
public void commentAdded(CommentEvent event) {... |
| 387 |
0
|
fail(); |
| 388 |
|
} |
| 389 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 390 |
0
|
public void commentRemoved(CommentEvent event) {... |
| 391 |
0
|
fail(); |
| 392 |
|
} |
| 393 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 394 |
0
|
public void commentApproved(CommentEvent event) {... |
| 395 |
0
|
fail(); |
| 396 |
|
} |
| 397 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 398 |
0
|
public void commentRejected(CommentEvent event) {... |
| 399 |
0
|
fail(); |
| 400 |
|
} |
| 401 |
|
}; |
| 402 |
|
|
| 403 |
2
|
blog.getEventListenerList().addCommentListener(listener); |
| 404 |
2
|
comment.setApproved(); |
| 405 |
|
} |
| 406 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (19) |
Complexity: 1 |
Complexity Density: 0,05 |
1
PASS
|
|
| 407 |
2
|
public void testNestedCommentsAreUnindexedWhenParentDeleted() throws Exception {... |
| 408 |
2
|
BlogService service = new BlogService(); |
| 409 |
2
|
Comment comment2 = blogEntry.createComment("Title", "Body", "Author", "me@somedomain.com", "http://www.google.com", "127.0.0.1"); |
| 410 |
2
|
Comment comment3 = blogEntry.createComment("Title", "Body", "Author", "me@somedomain.com", "http://www.google.com", "127.0.0.1"); |
| 411 |
|
|
| 412 |
2
|
service.putBlogEntry(blogEntry); |
| 413 |
2
|
blogEntry.addComment(comment); |
| 414 |
|
|
| 415 |
2
|
comment2.setParent(comment); |
| 416 |
2
|
blogEntry.addComment(comment2); |
| 417 |
2
|
service.putBlogEntry(blogEntry); |
| 418 |
|
|
| 419 |
2
|
comment3.setParent(comment); |
| 420 |
2
|
blogEntry.addComment(comment3); |
| 421 |
2
|
service.putBlogEntry(blogEntry); |
| 422 |
|
|
| 423 |
2
|
assertTrue(blog.getResponseIndex().getPendingResponses().contains(comment.getGuid())); |
| 424 |
2
|
assertTrue(blog.getResponseIndex().getPendingResponses().contains(comment2.getGuid())); |
| 425 |
2
|
assertTrue(blog.getResponseIndex().getPendingResponses().contains(comment3.getGuid())); |
| 426 |
|
|
| 427 |
2
|
blogEntry.removeComment(comment.getId()); |
| 428 |
2
|
service.putBlogEntry(blogEntry); |
| 429 |
|
|
| 430 |
2
|
assertFalse(blog.getResponseIndex().getPendingResponses().contains(comment.getGuid())); |
| 431 |
2
|
assertFalse(blog.getResponseIndex().getPendingResponses().contains(comment2.getGuid())); |
| 432 |
2
|
assertFalse(blog.getResponseIndex().getPendingResponses().contains(comment3.getGuid())); |
| 433 |
|
} |
| 434 |
|
|
| 435 |
|
} |