| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
package com.atlassian.theplugin.idea.crucible; |
| 18 |
|
|
| 19 |
|
import com.atlassian.theplugin.commons.VirtualFileSystem; |
| 20 |
|
import com.atlassian.theplugin.commons.cfg.CrucibleServerCfg; |
| 21 |
|
import com.atlassian.theplugin.commons.crucible.ValueNotYetInitialized; |
| 22 |
|
import com.atlassian.theplugin.commons.crucible.api.model.*; |
| 23 |
|
import com.atlassian.theplugin.idea.crucible.table.column.ReviewKeyComparator; |
| 24 |
|
import junit.framework.TestCase; |
| 25 |
|
|
| 26 |
|
import java.util.Date; |
| 27 |
|
import java.util.List; |
| 28 |
|
|
|
|
|
| 34.1% |
Uncovered Elements: 54 (82) |
Complexity: 34 |
Complexity Density: 0.71 |
|
| 29 |
|
public class ReviewKeyComparatorTest extends TestCase { |
| 30 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (18) |
Complexity: 1 |
Complexity Density: 0.06 |
1
PASS
|
|
| 31 |
1
|
public void testComparator() {... |
| 32 |
1
|
ReviewKeyComparator comparator = new ReviewKeyComparator(); |
| 33 |
|
|
| 34 |
1
|
assertEquals(0, comparator.compare(getReviewAdapter(null, null), getReviewAdapter(null, null))); |
| 35 |
1
|
assertEquals(0, comparator.compare(getReviewAdapter("CR", null), getReviewAdapter("CR", null))); |
| 36 |
1
|
assertEquals(0, comparator.compare(getReviewAdapter("CR", null), getReviewAdapter("CR", ""))); |
| 37 |
1
|
assertEquals(0, comparator.compare(getReviewAdapter("CR", ""), getReviewAdapter("CR", null))); |
| 38 |
1
|
assertEquals(0, comparator.compare(getReviewAdapter("CR", ""), getReviewAdapter("CR", ""))); |
| 39 |
1
|
assertEquals(-1, comparator.compare(getReviewAdapter("CR1", ""), getReviewAdapter("CR2", ""))); |
| 40 |
1
|
assertEquals(-1, comparator.compare(getReviewAdapter("A", ""), getReviewAdapter("B", ""))); |
| 41 |
1
|
assertEquals(0, comparator.compare(getReviewAdapter("CR", "freeText"), getReviewAdapter("CR", "freeText"))); |
| 42 |
1
|
assertEquals(0, comparator.compare(getReviewAdapter("CR", "freeText1"), getReviewAdapter("CR", "freeText2"))); |
| 43 |
1
|
assertEquals(-1, comparator.compare(getReviewAdapter("CR", "CR-1"), getReviewAdapter("CR", "CR-2"))); |
| 44 |
1
|
assertEquals(1, comparator.compare(getReviewAdapter("CR", "CR-2"), getReviewAdapter("CR", "CR-1"))); |
| 45 |
1
|
assertEquals(0, comparator.compare(getReviewAdapter("CR", "CR-FE-1"), getReviewAdapter("CR", "CR-FE-1"))); |
| 46 |
1
|
assertEquals(-1, comparator.compare(getReviewAdapter("CR", "CR-FE-1"), getReviewAdapter("CR", "CR-FE-2"))); |
| 47 |
1
|
assertEquals(1, comparator.compare(getReviewAdapter("CR", "CR-FE-3"), getReviewAdapter("CR", "CR-FE-1"))); |
| 48 |
1
|
assertTrue(comparator.compare(getReviewAdapter("CR", "CR-1"), getReviewAdapter("CR-FE", "CR-FE-1")) < 0); |
| 49 |
1
|
assertTrue(comparator.compare(getReviewAdapter("CR-FE", "CR-FE-1"), getReviewAdapter("CR", "CR-1")) > 0); |
| 50 |
1
|
assertEquals(0, comparator.compare(getReviewAdapter("CR", "-1"), getReviewAdapter("CR", "-1"))); |
| 51 |
|
} |
| 52 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 53 |
34
|
private ReviewAdapter getReviewAdapter(final String projectKey, final String key) {... |
| 54 |
34
|
Review review = new ReviewImpl() { |
| 55 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 56 |
0
|
public List<Reviewer> getReviewers() {... |
| 57 |
0
|
return null; |
| 58 |
|
} |
| 59 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 60 |
0
|
public List<GeneralComment> getGeneralComments() {... |
| 61 |
0
|
return null; |
| 62 |
|
} |
| 63 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 64 |
0
|
public List<VersionedComment> getVersionedComments() throws ValueNotYetInitialized {... |
| 65 |
0
|
return null; |
| 66 |
|
} |
| 67 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 68 |
0
|
public List<CrucibleFileInfo> getFiles() {... |
| 69 |
0
|
return null; |
| 70 |
|
} |
| 71 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 72 |
0
|
public List<Action> getTransitions() throws ValueNotYetInitialized {... |
| 73 |
0
|
return null; |
| 74 |
|
} |
| 75 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 76 |
0
|
public List<Action> getActions() throws ValueNotYetInitialized {... |
| 77 |
0
|
return null; |
| 78 |
|
} |
| 79 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 80 |
0
|
public VirtualFileSystem getVirtualFileSystem() {... |
| 81 |
0
|
return null; |
| 82 |
|
} |
| 83 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 84 |
0
|
public CrucibleServerCfg getServer() {... |
| 85 |
0
|
return null; |
| 86 |
|
} |
| 87 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 88 |
0
|
public String getReviewUrl() {... |
| 89 |
0
|
return null; |
| 90 |
|
} |
| 91 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 92 |
0
|
public Review getInnerReviewObject() {... |
| 93 |
0
|
return null; |
| 94 |
|
} |
| 95 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 96 |
0
|
public void setGeneralComments(final List<GeneralComment> generalComments) {... |
| 97 |
|
|
| 98 |
|
} |
| 99 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 100 |
0
|
public void removeGeneralComment(final GeneralComment comment) {... |
| 101 |
|
|
| 102 |
|
} |
| 103 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 104 |
0
|
public void removeVersionedComment(final VersionedComment vComment, final CrucibleFileInfo file) {... |
| 105 |
|
|
| 106 |
|
} |
| 107 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 108 |
0
|
public void setFilesAndVersionedComments(final List<CrucibleFileInfo> files, final List<VersionedComment> commentList) {... |
| 109 |
|
|
| 110 |
|
} |
| 111 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 112 |
0
|
public User getAuthor() {... |
| 113 |
0
|
return null; |
| 114 |
|
} |
| 115 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 116 |
0
|
public User getCreator() {... |
| 117 |
0
|
return null; |
| 118 |
|
} |
| 119 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 120 |
0
|
public String getDescription() {... |
| 121 |
0
|
return null; |
| 122 |
|
} |
| 123 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 124 |
0
|
public User getModerator() {... |
| 125 |
0
|
return null; |
| 126 |
|
} |
| 127 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 128 |
0
|
public String getName() {... |
| 129 |
0
|
return null; |
| 130 |
|
} |
| 131 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 132 |
0
|
public PermId getParentReview() {... |
| 133 |
0
|
return null; |
| 134 |
|
} |
| 135 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 136 |
34
|
public PermId getPermId() {... |
| 137 |
34
|
return new PermId() { |
| 138 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 139 |
34
|
public String getId() {... |
| 140 |
34
|
return key; |
| 141 |
|
} |
| 142 |
|
}; |
| 143 |
|
} |
| 144 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 145 |
73
|
public String getProjectKey() {... |
| 146 |
73
|
return projectKey; |
| 147 |
|
} |
| 148 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 149 |
0
|
public String getRepoName() {... |
| 150 |
0
|
return null; |
| 151 |
|
} |
| 152 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 153 |
0
|
public State getState() {... |
| 154 |
0
|
return null; |
| 155 |
|
} |
| 156 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 157 |
0
|
public boolean isAllowReviewerToJoin() {... |
| 158 |
0
|
return false; |
| 159 |
|
} |
| 160 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 161 |
0
|
public int getMetricsVersion() {... |
| 162 |
0
|
return 0; |
| 163 |
|
} |
| 164 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 165 |
0
|
public Date getCreateDate() {... |
| 166 |
0
|
return null; |
| 167 |
|
} |
| 168 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 169 |
0
|
public Date getCloseDate() {... |
| 170 |
0
|
return null; |
| 171 |
|
} |
| 172 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 173 |
0
|
public String getSummary() {... |
| 174 |
0
|
return null; |
| 175 |
|
} |
| 176 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 177 |
0
|
public CrucibleFileInfo getFileByPermId(PermId id) {... |
| 178 |
0
|
return null; |
| 179 |
|
} |
| 180 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 181 |
0
|
public String getServerUrl() {... |
| 182 |
0
|
return null; |
| 183 |
|
} |
| 184 |
|
}; |
| 185 |
|
|
| 186 |
34
|
return new ReviewAdapter(review, null); |
| 187 |
|
} |
| 188 |
|
} |