|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| This report was generated with an evaluation server license. Purchase Clover or configure your license. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| IndexedTagTest | Line # 42 | 15 | 0% | 3 | 0 | 100% |
1.0
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| (4) | |||
| Result | |||
|
0.44444445
|
net.sourceforge.pebble.domain.IndexedTagTest.testRemoveBlogEntry
net.sourceforge.pebble.domain.IndexedTagTest.testRemoveBlogEntry
|
1 PASS | |
|
0.44444445
|
net.sourceforge.pebble.domain.IndexedTagTest.testRemoveBlogEntry
net.sourceforge.pebble.domain.IndexedTagTest.testRemoveBlogEntry
|
1 PASS | |
|
0.3888889
|
net.sourceforge.pebble.domain.IndexedTagTest.testAddBlogEntry
net.sourceforge.pebble.domain.IndexedTagTest.testAddBlogEntry
|
1 PASS | |
|
0.3888889
|
net.sourceforge.pebble.domain.IndexedTagTest.testAddBlogEntry
net.sourceforge.pebble.domain.IndexedTagTest.testAddBlogEntry
|
1 PASS | |
| 1 | /* | |
| 2 | * Copyright (c) 2003-2006, Simon Brown | |
| 3 | * All rights reserved. | |
| 4 | * | |
| 5 | * Redistribution and use in source and binary forms, with or without | |
| 6 | * modification, are permitted provided that the following conditions are met: | |
| 7 | * | |
| 8 | * - Redistributions of source code must retain the above copyright | |
| 9 | * notice, this list of conditions and the following disclaimer. | |
| 10 | * | |
| 11 | * - Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in | |
| 13 | * the documentation and/or other materials provided with the | |
| 14 | * distribution. | |
| 15 | * | |
| 16 | * - Neither the name of Pebble nor the names of its contributors may | |
| 17 | * be used to endorse or promote products derived from this software | |
| 18 | * without specific prior written permission. | |
| 19 | * | |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
| 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | |
| 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 30 | * POSSIBILITY OF SUCH DAMAGE. | |
| 31 | */ | |
| 32 | package net.sourceforge.pebble.domain; | |
| 33 | ||
| 34 | import net.sourceforge.pebble.index.IndexedTag; | |
| 35 | ||
| 36 | ||
| 37 | /** | |
| 38 | * Tests for the IndexedTag class. | |
| 39 | * | |
| 40 | * @author Simon Brown | |
| 41 | */ | |
| 42 | public class IndexedTagTest extends SingleBlogTestCase { | |
| 43 | ||
| 44 | private IndexedTag tag; | |
| 45 | ||
| 46 | 4 |
protected void setUp() throws Exception { |
| 47 | 4 | super.setUp(); |
| 48 | ||
| 49 | 4 | tag = new IndexedTag("java", blog); |
| 50 | } | |
| 51 | ||
| 52 | 2 |
public void testAddBlogEntry() { |
| 53 | 2 | assertTrue(tag.getBlogEntries().isEmpty()); |
| 54 | 2 | assertEquals(0, tag.getNumberOfBlogEntries()); |
| 55 | 2 | String blogEntry = "1234567890"; |
| 56 | ||
| 57 | 2 | tag.addBlogEntry(blogEntry); |
| 58 | 2 | assertTrue(tag.getBlogEntries().contains(blogEntry)); |
| 59 | 2 | assertEquals(1, tag.getNumberOfBlogEntries()); |
| 60 | } | |
| 61 | ||
| 62 | 2 |
public void testRemoveBlogEntry() { |
| 63 | 2 | String blogEntry = "1234567890"; |
| 64 | 2 | tag.addBlogEntry(blogEntry); |
| 65 | 2 | assertTrue(tag.getBlogEntries().contains(blogEntry)); |
| 66 | 2 | assertEquals(1, tag.getNumberOfBlogEntries()); |
| 67 | ||
| 68 | 2 | tag.removeBlogEntry(blogEntry); |
| 69 | 2 | assertTrue(tag.getBlogEntries().isEmpty()); |
| 70 | 2 | assertEquals(0, tag.getNumberOfBlogEntries()); |
| 71 | } | |
| 72 | ||
| 73 | // public void testCalculateRanking() { | |
| 74 | // tag.calculateRank(0); | |
| 75 | // assertEquals(1, tag.getRank()); | |
| 76 | // | |
| 77 | // tag.calculateRank(10); | |
| 78 | // assertEquals(1, tag.getRank()); | |
| 79 | // | |
| 80 | // Day today = blog.getBlogForToday(); | |
| 81 | // BlogEntry blogEntry = today.createBlogEntry(); | |
| 82 | // today.addEntry(blogEntry); | |
| 83 | // tag.addBlogEntry(blogEntry); | |
| 84 | // tag.calculateRank(10); | |
| 85 | // assertEquals(1, tag.getRank()); | |
| 86 | // | |
| 87 | // blogEntry = today.createBlogEntry(); | |
| 88 | // today.addEntry(blogEntry); | |
| 89 | // tag.addBlogEntry(blogEntry); | |
| 90 | // tag.calculateRank(10); | |
| 91 | // assertEquals(2, tag.getRank()); | |
| 92 | // tag.calculateRank(5); | |
| 93 | // assertEquals(4, tag.getRank()); | |
| 94 | // | |
| 95 | // blogEntry = today.createBlogEntry(); | |
| 96 | // today.addEntry(blogEntry); | |
| 97 | // tag.addBlogEntry(blogEntry); | |
| 98 | // tag.calculateRank(10); | |
| 99 | // assertEquals(3, tag.getRank()); | |
| 100 | // tag.calculateRank(5); | |
| 101 | // assertEquals(6, tag.getRank()); | |
| 102 | // | |
| 103 | // blogEntry = today.createBlogEntry(); | |
| 104 | // today.addEntry(blogEntry); | |
| 105 | // tag.addBlogEntry(blogEntry); | |
| 106 | // tag.calculateRank(10); | |
| 107 | // assertEquals(4, tag.getRank()); | |
| 108 | // tag.calculateRank(5); | |
| 109 | // assertEquals(8, tag.getRank()); | |
| 110 | // | |
| 111 | // blogEntry = today.createBlogEntry(); | |
| 112 | // today.addEntry(blogEntry); | |
| 113 | // tag.addBlogEntry(blogEntry); | |
| 114 | // tag.calculateRank(10); | |
| 115 | // assertEquals(5, tag.getRank()); | |
| 116 | // tag.calculateRank(5); | |
| 117 | // assertEquals(10, tag.getRank()); | |
| 118 | // | |
| 119 | // blogEntry = today.createBlogEntry(); | |
| 120 | // today.addEntry(blogEntry); | |
| 121 | // tag.addBlogEntry(blogEntry); | |
| 122 | // tag.calculateRank(10); | |
| 123 | // assertEquals(6, tag.getRank()); | |
| 124 | // | |
| 125 | // blogEntry = today.createBlogEntry(); | |
| 126 | // today.addEntry(blogEntry); | |
| 127 | // tag.addBlogEntry(blogEntry); | |
| 128 | // tag.calculateRank(10); | |
| 129 | // assertEquals(7, tag.getRank()); | |
| 130 | // | |
| 131 | // blogEntry = today.createBlogEntry(); | |
| 132 | // today.addEntry(blogEntry); | |
| 133 | // tag.addBlogEntry(blogEntry); | |
| 134 | // tag.calculateRank(10); | |
| 135 | // assertEquals(8, tag.getRank()); | |
| 136 | // | |
| 137 | // blogEntry = today.createBlogEntry(); | |
| 138 | // today.addEntry(blogEntry); | |
| 139 | // tag.addBlogEntry(blogEntry); | |
| 140 | // tag.calculateRank(10); | |
| 141 | // assertEquals(9, tag.getRank()); | |
| 142 | // | |
| 143 | // blogEntry = today.createBlogEntry(); | |
| 144 | // today.addEntry(blogEntry); | |
| 145 | // tag.addBlogEntry(blogEntry); | |
| 146 | // tag.calculateRank(10); | |
| 147 | // assertEquals(10, tag.getRank()); | |
| 148 | // | |
| 149 | // blogEntry = today.createBlogEntry(); | |
| 150 | // today.addEntry(blogEntry); | |
| 151 | // tag.addBlogEntry(blogEntry); | |
| 152 | // tag.calculateRank(10); | |
| 153 | // assertEquals(10, tag.getRank()); | |
| 154 | // } | |
| 155 | ||
| 156 | } | |
|
||||||||||||