From 20a00c5e0da9789179ecb0ca2b707eb30f7cf565 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Wed, 13 Jan 2010 20:08:43 +0000 Subject: [PATCH] turns out I couldn't use it, but since I wrote it, I'm committing it. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@25774 71c3de6d-444a-0410-be80-ed276b4c234a --- .../test/DefaultConstructorChecker.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/src/main/java/org/jvnet/hudson/test/DefaultConstructorChecker.java diff --git a/test/src/main/java/org/jvnet/hudson/test/DefaultConstructorChecker.java b/test/src/main/java/org/jvnet/hudson/test/DefaultConstructorChecker.java new file mode 100644 index 0000000000..9c862edc47 --- /dev/null +++ b/test/src/main/java/org/jvnet/hudson/test/DefaultConstructorChecker.java @@ -0,0 +1,28 @@ +package org.jvnet.hudson.test; + +import junit.framework.TestCase; + +/** + * Tests that the specified class has the default constructor. + * + * @author Kohsuke Kawaguchi + */ +public class DefaultConstructorChecker extends TestCase { + private final Class clazz; + + public DefaultConstructorChecker(Class clazz) { + this.clazz = clazz; + setName(clazz.getName()+".verifyDefaultConstructor"); + } + + @Override + protected void runTest() throws Throwable { + try { + clazz.getConstructor(); + } catch (NoSuchMethodException e) { + throw new Error(clazz+" must have the default constructor",e); + } catch (SecurityException e) { + throw new Error(clazz+" must have the default constructor",e); + } + } +} -- GitLab