1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 */ 18 19 package org.apache.bcel; 20 21 import org.apache.bcel.classfile.JavaClass; 22 23 public class CounterVisitorTestCase extends AbstractCounterVisitorTestCase 24 { 25 @Override getTestClass()26 protected JavaClass getTestClass() throws ClassNotFoundException 27 { 28 return getTestClass(PACKAGE_BASE_NAME+".data.MarkedType"); 29 } 30 testAnnotationsCount()31 public void testAnnotationsCount() 32 { 33 assertEquals("annotationCount", 2, getVisitor().annotationCount); 34 } 35 testAnnotationDefaultCount()36 public void testAnnotationDefaultCount() 37 { 38 assertEquals("annotationDefaultCount", 0, getVisitor().annotationDefaultCount); 39 } 40 testAnnotationEntryCount()41 public void testAnnotationEntryCount() 42 { 43 assertEquals("annotationEntryCount", 2, getVisitor().annotationEntryCount); 44 } 45 testCodeCount()46 public void testCodeCount() 47 { 48 assertEquals("codeCount", 1, getVisitor().codeCount); 49 } 50 testCodeExceptionCount()51 public void testCodeExceptionCount() 52 { 53 assertEquals("codeExceptionCount", 0, getVisitor().codeExceptionCount); 54 } 55 testConstantClassCount()56 public void testConstantClassCount() 57 { 58 assertEquals("constantClassCount", 2, getVisitor().constantClassCount); 59 } 60 testConstantDoubleCount()61 public void testConstantDoubleCount() 62 { 63 assertEquals("constantDoubleCount", 0, getVisitor().constantDoubleCount); 64 } 65 testConstantFieldrefCount()66 public void testConstantFieldrefCount() 67 { 68 assertEquals("constantFieldrefCount", 0, getVisitor().constantFieldrefCount); 69 } 70 testConstantFloatCount()71 public void testConstantFloatCount() 72 { 73 assertEquals("constantFloatCount", 0, getVisitor().constantFloatCount); 74 } 75 testConstantIntegerCount()76 public void testConstantIntegerCount() 77 { 78 assertEquals("constantIntegerCount", 0, getVisitor().constantIntegerCount); 79 } 80 testConstantInterfaceMethodrefCount()81 public void testConstantInterfaceMethodrefCount() 82 { 83 assertEquals("constantInterfaceMethodrefCount", 0, getVisitor().constantInterfaceMethodrefCount); 84 } 85 testConstantLongCount()86 public void testConstantLongCount() 87 { 88 assertEquals("constantLongCount", 0, getVisitor().constantLongCount); 89 } 90 testConstantMethodrefCount()91 public void testConstantMethodrefCount() 92 { 93 assertEquals("constantMethodrefCount", 1, getVisitor().constantMethodrefCount); 94 } 95 testConstantNameAndTypeCount()96 public void testConstantNameAndTypeCount() 97 { 98 assertEquals("constantNameAndTypeCount", 1, getVisitor().constantNameAndTypeCount); 99 } 100 testConstantPoolCount()101 public void testConstantPoolCount() 102 { 103 assertEquals("constantPoolCount", 1, getVisitor().constantPoolCount); 104 } 105 testConstantStringCount()106 public void testConstantStringCount() 107 { 108 assertEquals("constantStringCount", 0, getVisitor().constantStringCount); 109 } 110 testConstantValueCount()111 public void testConstantValueCount() 112 { 113 assertEquals("constantValueCount", 0, getVisitor().constantValueCount); 114 } 115 testDeprecatedCount()116 public void testDeprecatedCount() 117 { 118 assertEquals("deprecatedCount", 0, getVisitor().deprecatedCount); 119 } 120 testEnclosingMethodCount()121 public void testEnclosingMethodCount() 122 { 123 assertEquals("enclosingMethodCount", 0, getVisitor().enclosingMethodCount); 124 } 125 testExceptionTableCount()126 public void testExceptionTableCount() 127 { 128 assertEquals("exceptionTableCount", 0, getVisitor().exceptionTableCount); 129 } 130 testFieldCount()131 public void testFieldCount() 132 { 133 assertEquals("fieldCount", 0, getVisitor().fieldCount); 134 } 135 testInnerClassCount()136 public void testInnerClassCount() 137 { 138 assertEquals("innerClassCount", 0, getVisitor().innerClassCount); 139 } 140 testInnerClassesCount()141 public void testInnerClassesCount() 142 { 143 assertEquals("innerClassesCount", 0, getVisitor().innerClassesCount); 144 } 145 testJavaClassCount()146 public void testJavaClassCount() 147 { 148 assertEquals("javaClassCount", 1, getVisitor().javaClassCount); 149 } 150 testLineNumberCount()151 public void testLineNumberCount() 152 { 153 assertEquals("lineNumberCount", 1, getVisitor().lineNumberCount); 154 } 155 testLineNumberTableCount()156 public void testLineNumberTableCount() 157 { 158 assertEquals("lineNumberTableCount", 1, getVisitor().lineNumberTableCount); 159 } 160 testLocalVariableCount()161 public void testLocalVariableCount() 162 { 163 assertEquals("localVariableCount", 1, getVisitor().localVariableCount); 164 } 165 testLocalVariableTableCount()166 public void testLocalVariableTableCount() 167 { 168 assertEquals("localVariableTableCount", 1, getVisitor().localVariableTableCount); 169 } 170 testLocalVariableTypeTableCount()171 public void testLocalVariableTypeTableCount() 172 { 173 assertEquals("localVariableTypeTableCount", 0, getVisitor().localVariableTypeTableCount); 174 } 175 testMethodCount()176 public void testMethodCount() 177 { 178 assertEquals("methodCount", 1, getVisitor().methodCount); 179 } 180 testParameterAnnotationCount()181 public void testParameterAnnotationCount() 182 { 183 assertEquals("parameterAnnotationCount", 0, getVisitor().parameterAnnotationCount); 184 } 185 testSignatureCount()186 public void testSignatureCount() 187 { 188 assertEquals("signatureAnnotationCount", 0, getVisitor().signatureAnnotationCount); 189 } 190 testSourceFileCount()191 public void testSourceFileCount() 192 { 193 assertEquals("sourceFileCount", 1, getVisitor().sourceFileCount); 194 } 195 testStackMapCount()196 public void testStackMapCount() 197 { 198 assertEquals("stackMapCount", 0, getVisitor().stackMapCount); 199 } 200 testStackMapEntryCount()201 public void testStackMapEntryCount() 202 { 203 assertEquals("stackMapEntryCount", 0, getVisitor().stackMapEntryCount); 204 } 205 testSyntheticCount()206 public void testSyntheticCount() 207 { 208 assertEquals("syntheticCount", 0, getVisitor().syntheticCount); 209 } 210 testUnknownCount()211 public void testUnknownCount() 212 { 213 assertEquals("unknownCount", 0, getVisitor().unknownCount); 214 } 215 } 216