Clover Coverage Report - Atlassian Intellij IDEA Plugin
Coverage timestamp: Fri Nov 14 2008 12:12:14 CET
48   188   34   1.41
0   129   0.71   34
34     1  
1    
 
 
  ReviewKeyComparatorTest       Line # 29 48 34 34.1% 0.34146342
 
  (1)
 
1    /**
2    * Copyright (C) 2008 Atlassian
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10    * Unless required by applicable law or agreed to in writing, software
11    * distributed under the License is distributed on an "AS IS" BASIS,
12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    * See the License for the specific language governing permissions and
14    * limitations under the License.
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   
 
29    public class ReviewKeyComparatorTest extends TestCase {
30   
 
31  1 toggle 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   
 
53  34 toggle private ReviewAdapter getReviewAdapter(final String projectKey, final String key) {
54  34 Review review = new ReviewImpl() {
55   
 
56  0 toggle public List<Reviewer> getReviewers() {
57  0 return null;
58    }
59   
 
60  0 toggle public List<GeneralComment> getGeneralComments() {
61  0 return null;
62    }
63   
 
64  0 toggle public List<VersionedComment> getVersionedComments() throws ValueNotYetInitialized {
65  0 return null;
66    }
67   
 
68  0 toggle public List<CrucibleFileInfo> getFiles() {
69  0 return null;
70    }
71   
 
72  0 toggle public List<Action> getTransitions() throws ValueNotYetInitialized {
73  0 return null;
74    }
75   
 
76  0 toggle public List<Action> getActions() throws ValueNotYetInitialized {
77  0 return null;
78    }
79   
 
80  0 toggle public VirtualFileSystem getVirtualFileSystem() {
81  0 return null;
82    }
83   
 
84  0 toggle public CrucibleServerCfg getServer() {
85  0 return null;
86    }
87   
 
88  0 toggle public String getReviewUrl() {
89  0 return null;
90    }
91   
 
92  0 toggle public Review getInnerReviewObject() {
93  0 return null;
94    }
95   
 
96  0 toggle public void setGeneralComments(final List<GeneralComment> generalComments) {
97    // not implemented
98    }
99   
 
100  0 toggle public void removeGeneralComment(final GeneralComment comment) {
101    // not implemented
102    }
103   
 
104  0 toggle public void removeVersionedComment(final VersionedComment vComment, final CrucibleFileInfo file) {
105    // not implemented
106    }
107   
 
108  0 toggle public void setFilesAndVersionedComments(final List<CrucibleFileInfo> files, final List<VersionedComment> commentList) {
109   
110    }
111   
 
112  0 toggle public User getAuthor() {
113  0 return null;
114    }
115   
 
116  0 toggle public User getCreator() {
117  0 return null;
118    }
119   
 
120  0 toggle public String getDescription() {
121  0 return null;
122    }
123   
 
124  0 toggle public User getModerator() {
125  0 return null;
126    }
127   
 
128  0 toggle public String getName() {
129  0 return null;
130    }
131   
 
132  0 toggle public PermId getParentReview() {
133  0 return null;
134    }
135   
 
136  34 toggle public PermId getPermId() {
137  34 return new PermId() {
138   
 
139  34 toggle public String getId() {
140  34 return key;
141    }
142    };
143    }
144   
 
145  73 toggle public String getProjectKey() {
146  73 return projectKey;
147    }
148   
 
149  0 toggle public String getRepoName() {
150  0 return null;
151    }
152   
 
153  0 toggle public State getState() {
154  0 return null;
155    }
156   
 
157  0 toggle public boolean isAllowReviewerToJoin() {
158  0 return false;
159    }
160   
 
161  0 toggle public int getMetricsVersion() {
162  0 return 0;
163    }
164   
 
165  0 toggle public Date getCreateDate() {
166  0 return null;
167    }
168   
 
169  0 toggle public Date getCloseDate() {
170  0 return null;
171    }
172   
 
173  0 toggle public String getSummary() {
174  0 return null;
175    }
176   
 
177  0 toggle public CrucibleFileInfo getFileByPermId(PermId id) {
178  0 return null;
179    }
180   
 
181  0 toggle public String getServerUrl() {
182  0 return null;
183    }
184    };
185   
186  34 return new ReviewAdapter(review, null);
187    }
188    }