File D:\maven-qcr-plugin-testsunitaires\qcr4java\jenkins-master\target\site\qc\test\src\main\java\org\jvnet\hudson\test\DefaultConstructorChecker.java.html

1 package org.jvnet.hudson.test;
2
3 import junit.framework.TestCase;
4
5 /**
6 * Tests that the specified class has the default constructor.
7 *
8 * @author Kohsuke Kawaguchi
9 */
10 public class DefaultConstructorChecker extends TestCase {
11 private final Class clazz;
12
13 public DefaultConstructorChecker(Class clazz) {
14 this.clazz = clazz;
15 setName(clazz.getName()+".verifyDefaultConstructor");
16 }
17
18 @Override
19 protected void runTest() throws Throwable {
20 try {
21 clazz.getConstructor();
22 } catch (NoSuchMethodException e) {
23 throw new Error(clazz+" must have the default constructor",e);
24 } catch (SecurityException e) {
25 throw new Error(clazz+" must have the default constructor",e);
26 }
27 }
28 }
29