KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > compliance > standard > ConstructorInfoTEST


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7
8 package test.compliance.standard;
9
10 import junit.framework.TestCase;
11
12 import javax.management.MBeanConstructorInfo;
13 import javax.management.MBeanInfo;
14
15 /**
16  * @author <a HREF="mailto:trevor@protocool.com">Trevor Squires</a>.
17  */

18
19 public class ConstructorInfoTEST extends TestCase
20 {
21    private String failureHint;
22    private MBeanInfo info;
23    private String constructorName;
24    private String signatureString;
25
26    public ConstructorInfoTEST(String failureHint, MBeanInfo info, String constructorName, String[] signature)
27    {
28       super("testValidConstructor");
29       this.failureHint = failureHint;
30       this.info = info;
31       this.constructorName = constructorName;
32       this.signatureString = InfoUtil.makeSignatureString(signature);
33    }
34
35    public void testValidConstructor()
36    {
37       MBeanConstructorInfo[] constructors = info.getConstructors();
38
39       MBeanConstructorInfo foundConstructor= null;
40
41       for (int i = 0; i < constructors.length; i++)
42       {
43             if (signatureString.equals(InfoUtil.makeSignatureString(constructors[i].getSignature())))
44             {
45                foundConstructor = constructors[i];
46                break;
47             }
48       }
49
50       assertNotNull(failureHint + ": " + info.getClassName() + "." + constructorName + signatureString + " was not found", foundConstructor);
51    }
52 }
53
Popular Tags