|
12 | 12 | import com.sandwich.koan.path.xmltransformation.KoanElementAttributes; |
13 | 13 | import com.sandwich.koan.path.xmltransformation.XmlToPathTransformer; |
14 | 14 | import com.sandwich.koan.path.xmltransformation.XmlToPathTransformerImpl; |
15 | | -import com.sandwich.util.Counter; |
16 | 15 | import com.sandwich.util.io.FileUtils; |
17 | 16 | import com.sandwich.util.io.directories.DirectoryManager; |
18 | 17 |
|
@@ -87,28 +86,30 @@ public int getTotalNumberOfKoans() { |
87 | 86 | if(methodName != null){ |
88 | 87 | return 1; |
89 | 88 | } |
90 | | - Counter total = new Counter(); |
| 89 | + int total = 0; |
91 | 90 | Iterator<Entry<String, Map<String, Map<String, KoanElementAttributes>>>> koanMethodsBySuiteByPackageIter = |
92 | 91 | getKoanMethodsBySuiteByPackage(); |
93 | 92 | while(koanMethodsBySuiteByPackageIter.hasNext()){ |
94 | 93 | Entry<String, Map<String, Map<String, KoanElementAttributes>>> e = koanMethodsBySuiteByPackageIter.next(); |
95 | 94 | for(Entry<String, Map<String, KoanElementAttributes>> e1 : e.getValue().entrySet()){ |
96 | | - countKoanAnnotationsInJavaFileGivenClassName(e1.getKey(), total); |
| 95 | + total += countKoanAnnotationsInJavaFileGivenClassName(e1.getKey()); |
97 | 96 | } |
98 | 97 | } |
99 | | - return (int)total.getCount(); |
| 98 | + return total; |
100 | 99 | } |
101 | 100 |
|
102 | | - private void countKoanAnnotationsInJavaFileGivenClassName(String className, Counter total) { |
| 101 | + private int countKoanAnnotationsInJavaFileGivenClassName(String className) { |
103 | 102 | String[] lines = FileUtils.getContentsOfOriginalJavaFile(className).split(KoanConstants.EOLS); |
104 | 103 | String koanClassSimpleNameWithAnnotationPrefix = '@'+Koan.class.getSimpleName(); |
| 104 | + int total = 0; |
105 | 105 | for(String line : lines){ |
106 | 106 | String trimmedLine = line.trim(); |
107 | 107 | if(trimmedLine.contains(koanClassSimpleNameWithAnnotationPrefix) |
108 | 108 | && !trimmedLine.startsWith("//") && !trimmedLine.startsWith("*") && !trimmedLine.startsWith("/*")){ |
109 | | - total.count(); |
| 109 | + total++; |
110 | 110 | } |
111 | 111 | } |
| 112 | + return total; |
112 | 113 | } |
113 | 114 |
|
114 | 115 | public Iterator<Entry<String, Map<String, Map<String, KoanElementAttributes>>>> iterator() { |
|
0 commit comments