|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.groboutils.junit.v1.AssertConstructor
A set of assert methods that test a class for implementation of specific constructor types.
Field Summary | |
static int |
ANY_PROTECTION
Bit-mask that allows the constructor to have any protection. |
static int |
PACKAGE
Bit-mask that allows for the constructor to have package-private access. |
static int |
PRIVATE
Bit-mask that allows for the constructor to have private access. |
static int |
PROTECTED
Bit-mask that allows for the constructor to have protected access. |
static int |
PUBLIC
Bit-mask that allows for the constructor to have public access. |
Constructor Summary | |
AssertConstructor()
|
Method Summary | |
static void |
assertHasConstructor(java.lang.Class c,
java.lang.Class[] arguments)
Ensures that there exists a public constructor in class c that accepts the same number of arguments given in arguments, and that the constructor has the same class or an instance of the class in each position of the argument list. |
static void |
assertHasConstructor(java.lang.Class c,
java.lang.Class[] arguments,
int protection)
Ensures that there exists a constructor in class c that accepts the same number of arguments given in arguments, and that the constructor has the same class or an instance of the class in each position of the argument list. |
static void |
assertHasConstructor(java.lang.Object o,
java.lang.Class[] arguments)
Ensures that there exists a public constructor in class c that accepts the same number of arguments given in arguments, and that the constructor has the same class or an instance of the class in each position of the argument list. |
static void |
assertHasConstructor(java.lang.Object o,
java.lang.Class[] arguments,
int protection)
Ensures that there exists a constructor in class c that accepts the same number of arguments given in arguments, and that the constructor has the same class or an instance of the class in each position of the argument list. |
static void |
assertHasConstructor(java.lang.String message,
java.lang.Class c,
java.lang.Class[] arguments)
Ensures that there exists a public constructor in class c that accepts the same number of arguments given in arguments, and that the constructor has the same class or an instance of the class in each position of the argument list. |
static void |
assertHasConstructor(java.lang.String message,
java.lang.Class c,
java.lang.Class[] arguments,
int protection)
Ensures that there exists a constructor in class c that accepts the same number of arguments given in arguments, and that the constructor has the same class or an instance of the class in each position of the argument list. |
static void |
assertHasConstructor(java.lang.String message,
java.lang.Object o,
java.lang.Class[] arguments)
Ensures that there exists a public constructor in class c that accepts the same number of arguments given in arguments, and that the constructor has the same class or an instance of the class in each position of the argument list. |
static void |
assertHasConstructor(java.lang.String message,
java.lang.Object o,
java.lang.Class[] arguments,
int protection)
Ensures that there exists a constructor in class c that accepts the same number of arguments given in arguments, and that the constructor has the same class or an instance of the class in each position of the argument list. |
static void |
assertHasDefaultConstructor(java.lang.Class c)
Ensures that the class c has a default (no-arg), public constructor. |
static void |
assertHasDefaultConstructor(java.lang.Object o)
Ensures that the class for object o has a default (no-arg), public constructor. |
static void |
assertHasDefaultConstructor(java.lang.String message,
java.lang.Class c)
Ensures that the class c has a default (no-arg), public constructor. |
static void |
assertHasDefaultConstructor(java.lang.String message,
java.lang.Object o)
Ensures that the class for object o has a default (no-arg), public constructor. |
static void |
assertHasSameConstructor(java.lang.Class c,
java.lang.Class[] arguments)
Ensures that there exists a public constructor in class c that accepts the same number of arguments given in arguments, and that the constructor has the same class or an instance of the class in each position of the argument list. |
static void |
assertHasSameConstructor(java.lang.Class c,
java.lang.Class[] arguments,
int protection)
Ensures that there exists a constructor in class c that accepts the same number of arguments given in arguments, and that the constructor has the same class or an instance of the class in each position of the argument list. |
static void |
assertHasSameConstructor(java.lang.Object o,
java.lang.Class[] arguments)
Ensures that there exists a public constructor in class c that accepts the same number of arguments given in arguments, and that the constructor has the same class or an instance of the class in each position of the argument list. |
static void |
assertHasSameConstructor(java.lang.Object o,
java.lang.Class[] arguments,
int protection)
Ensures that there exists a constructor in class c that accepts the same number of arguments given in arguments, and that the constructor has the same class or an instance of the class in each position of the argument list. |
static void |
assertHasSameConstructor(java.lang.String message,
java.lang.Class c,
java.lang.Class[] arguments)
Ensures that there exists a public constructor in class c that accepts the same number of arguments given in arguments, and that the constructor has the same class or an instance of the class in each position of the argument list. |
static void |
assertHasSameConstructor(java.lang.String message,
java.lang.Class c,
java.lang.Class[] arguments,
int protection)
Ensures that there exists a constructor in class c that accepts the same number of arguments given in arguments, and that the constructor has the same class or an instance of the class in each position of the argument list. |
static void |
assertHasSameConstructor(java.lang.String message,
java.lang.Object o,
java.lang.Class[] arguments)
Ensures that there exists a public constructor in class c that accepts the same number of arguments given in arguments, and that the constructor has the same class or an instance of the class in each position of the argument list. |
static void |
assertHasSameConstructor(java.lang.String message,
java.lang.Object o,
java.lang.Class[] arguments,
int protection)
Ensures that there exists a constructor in class c that accepts the same number of arguments given in arguments, and that the constructor has the same class or an instance of the class in each position of the argument list. |
static java.lang.reflect.Constructor |
getConstructor(java.lang.Class c,
java.lang.Class[] arguments,
int protection)
Retrieves the first constructor in class c that accepts the same number of arguments given in arguments, and that the constructor has the same class or an instance of the class in each position of the argument list, or null if there is no such constructor. |
static java.lang.reflect.Constructor |
getSameConstructor(java.lang.Class c,
java.lang.Class[] arguments,
int protection)
Retrieves the constructor in class c that accepts the exact argument list given in arguments, or null if there is no such constructor. |
protected static boolean |
hasCorrectProtection(java.lang.reflect.Constructor cntr,
int protection)
|
protected static boolean |
isInheritedParameters(java.lang.reflect.Constructor cntr,
java.lang.Class[] arguments)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int PUBLIC
public static final int PROTECTED
public static final int PACKAGE
public static final int PRIVATE
public static final int ANY_PROTECTION
Constructor Detail |
public AssertConstructor()
Method Detail |
public static void assertHasDefaultConstructor(java.lang.String message, java.lang.Class c)
message
- message that describes what failed if the assertion
fails.c
- the class check for a constructor.public static void assertHasDefaultConstructor(java.lang.Class c)
c
- the class check for a constructor.public static void assertHasDefaultConstructor(java.lang.String message, java.lang.Object o)
message
- message that describes what failed if the assertion
fails.o
- the object to check the class's constructor.public static void assertHasDefaultConstructor(java.lang.Object o)
o
- the object to check the class's constructor.public static void assertHasConstructor(java.lang.String message, java.lang.Class c, java.lang.Class[] arguments, int protection)
message
- message that describes what failed if the assertion
fails.c
- the class check for a constructor.arguments
- list of classes which the constructor must have
as parameters, or subclasses of the arguments. A null
argument index indicates that any type is allowed (equivalent
to specifying Object.class in the argument). If
the array is null, then the argument list will only
match the default (no-argument) constructor (which is the
same as setting arguments to new Class[0]).protection
- a bitwise ORed value containing one or more of the
constants PUBLIC, PROTECTED, PACKAGE,
or PRIVATE.assertHasConstructor( String, Class, Class[] )
,
assertHasConstructor( String, Object, Class[], int )
,
assertHasSameConstructor( String, Class, Class[], int )
public static void assertHasConstructor(java.lang.Class c, java.lang.Class[] arguments, int protection)
arguments
- list of classes which the constructor must have
as parameters, or subclasses of the arguments. A null
argument index indicates that any type is allowed (equivalent
to specifying Object.class in the argument). If
the array is null, then the argument list will only
match the default (no-argument) constructor (which is the
same as setting arguments to new Class[0]).protection
- a bitwise ORed value containing one or more of the
constants PUBLIC, PROTECTED, PACKAGE,
or PRIVATE.assertHasConstructor( Class, Class[] )
,
assertHasConstructor( Object, Class[], int )
,
assertHasSameConstructor( Class, Class[], int )
public static void assertHasConstructor(java.lang.String message, java.lang.Class c, java.lang.Class[] arguments)
arguments
- list of classes which the constructor must have
as parameters, or subclasses of the arguments. A null
argument index indicates that any type is allowed (equivalent
to specifying Object.class in the argument). If
the array is null, then the argument list will only
match the default (no-argument) constructor (which is the
same as setting arguments to new Class[0]).assertHasConstructor( String, Class, Class[], int )
,
assertHasConstructor( String, Object, Class[] )
,
assertHasSameConstructor( String, Class, Class[] )
public static void assertHasConstructor(java.lang.Class c, java.lang.Class[] arguments)
arguments
- list of classes which the constructor must have
as parameters, or subclasses of the arguments. A null
argument index indicates that any type is allowed (equivalent
to specifying Object.class in the argument). If
the array is null, then the argument list will only
match the default (no-argument) constructor (which is the
same as setting arguments to new Class[0]).assertHasConstructor( Class, Class[], int )
,
assertHasConstructor( Object, Class[] )
,
assertHasSameConstructor( Class, Class[] )
public static void assertHasConstructor(java.lang.String message, java.lang.Object o, java.lang.Class[] arguments, int protection)
arguments
- list of classes which the constructor must have
as parameters, or subclasses of the arguments. A null
argument index indicates that any type is allowed (equivalent
to specifying Object.class in the argument). If
the array is null, then the argument list will only
match the default (no-argument) constructor (which is the
same as setting arguments to new Class[0]).protection
- a bitwise ORed value containing one or more of the
constants PUBLIC, PROTECTED, PACKAGE,
or PRIVATE.assertHasConstructor( String, Object, Class[] )
,
assertHasConstructor( String, Class, Class[], int )
,
assertHasSameConstructor( String, Object, Class[], int )
public static void assertHasConstructor(java.lang.Object o, java.lang.Class[] arguments, int protection)
arguments
- list of classes which the constructor must have
as parameters, or subclasses of the arguments. A null
argument index indicates that any type is allowed (equivalent
to specifying Object.class in the argument). If
the array is null, then the argument list will only
match the default (no-argument) constructor (which is the
same as setting arguments to new Class[0]).protection
- a bitwise ORed value containing one or more of the
constants PUBLIC, PROTECTED, PACKAGE,
or PRIVATE.assertHasConstructor( Object, Class[] )
,
assertHasConstructor( Class, Class[], int )
,
assertHasSameConstructor( Object, Class[], int )
public static void assertHasConstructor(java.lang.String message, java.lang.Object o, java.lang.Class[] arguments)
arguments
- list of classes which the constructor must have
as parameters, or subclasses of the arguments. A null
argument index indicates that any type is allowed (equivalent
to specifying Object.class in the argument). If
the array is null, then the argument list will only
match the default (no-argument) constructor (which is the
same as setting arguments to new Class[0]).assertHasConstructor( String, Object, Class[], int )
,
assertHasConstructor( String, Class, Class[] )
,
assertHasSameConstructor( String, Object, Class[] )
public static void assertHasConstructor(java.lang.Object o, java.lang.Class[] arguments)
arguments
- list of classes which the constructor must have
as parameters, or subclasses of the arguments. A null
argument index indicates that any type is allowed (equivalent
to specifying Object.class in the argument). If
the array is null, then the argument list will only
match the default (no-argument) constructor (which is the
same as setting arguments to new Class[0]).assertHasConstructor( Object, Class[], int )
,
assertHasConstructor( Class, Class[] )
,
assertHasSameConstructor( Object, Class[] )
public static void assertHasSameConstructor(java.lang.String message, java.lang.Class c, java.lang.Class[] arguments, int protection)
arguments
- list of classes which the constructor must have
as parameters, or subclasses of the arguments. A null
argument index indicates that any type is allowed (equivalent
to specifying Object.class in the argument). If
the array is null, then the argument list will only
match the default (no-argument) constructor (which is the
same as setting arguments to new Class[0]).protection
- a bitwise ORed value containing one or more of the
constants PUBLIC, PROTECTED, PACKAGE,
or PRIVATE.assertHasSameConstructor( String, Class, Class[] )
,
assertHasSameConstructor( String, Object, Class[], int )
,
assertHasConstructor( String, Class, Class[], int )
public static void assertHasSameConstructor(java.lang.Class c, java.lang.Class[] arguments, int protection)
arguments
- list of classes which the constructor must have
as parameters, or subclasses of the arguments. A null
argument index indicates that any type is allowed (equivalent
to specifying Object.class in the argument). If
the array is null, then the argument list will only
match the default (no-argument) constructor (which is the
same as setting arguments to new Class[0]).protection
- a bitwise ORed value containing one or more of the
constants PUBLIC, PROTECTED, PACKAGE,
or PRIVATE.assertHasSameConstructor( Class, Class[] )
,
assertHasSameConstructor( Object, Class[], int )
,
assertHasConstructor( Class, Class[], int )
public static void assertHasSameConstructor(java.lang.String message, java.lang.Class c, java.lang.Class[] arguments)
arguments
- list of classes which the constructor must have
as parameters, or subclasses of the arguments. A null
argument index indicates that any type is allowed (equivalent
to specifying Object.class in the argument). If
the array is null, then the argument list will only
match the default (no-argument) constructor (which is the
same as setting arguments to new Class[0]).assertHasSameConstructor( String, Class, Class[], int )
,
assertHasSameConstructor( String, Object, Class[] )
,
assertHasConstructor( String, Class, Class[] )
public static void assertHasSameConstructor(java.lang.Class c, java.lang.Class[] arguments)
arguments
- list of classes which the constructor must have
as parameters, or subclasses of the arguments. A null
argument index indicates that any type is allowed (equivalent
to specifying Object.class in the argument). If
the array is null, then the argument list will only
match the default (no-argument) constructor (which is the
same as setting arguments to new Class[0]).assertHasSameConstructor( Class, Class[], int )
,
assertHasSameConstructor( Object, Class[] )
,
assertHasConstructor( Class, Class[] )
public static void assertHasSameConstructor(java.lang.String message, java.lang.Object o, java.lang.Class[] arguments, int protection)
arguments
- list of classes which the constructor must have
as parameters, or subclasses of the arguments. A null
argument index indicates that any type is allowed (equivalent
to specifying Object.class in the argument). If
the array is null, then the argument list will only
match the default (no-argument) constructor (which is the
same as setting arguments to new Class[0]).protection
- a bitwise ORed value containing one or more of the
constants PUBLIC, PROTECTED, PACKAGE,
or PRIVATE.assertHasSameConstructor( String, Object, Class[] )
,
assertHasSameConstructor( String, Class, Class[], int )
,
assertHasConstructor( String, Object, Class[], int )
public static void assertHasSameConstructor(java.lang.Object o, java.lang.Class[] arguments, int protection)
arguments
- list of classes which the constructor must have
as parameters, or subclasses of the arguments. A null
argument index indicates that any type is allowed (equivalent
to specifying Object.class in the argument). If
the array is null, then the argument list will only
match the default (no-argument) constructor (which is the
same as setting arguments to new Class[0]).protection
- a bitwise ORed value containing one or more of the
constants PUBLIC, PROTECTED, PACKAGE,
or PRIVATE.assertHasSameConstructor( Object, Class[] )
,
assertHasSameConstructor( Class, Class[], int )
,
assertHasConstructor( Object, Class[], int )
public static void assertHasSameConstructor(java.lang.String message, java.lang.Object o, java.lang.Class[] arguments)
arguments
- list of classes which the constructor must have
as parameters, or subclasses of the arguments. A null
argument index indicates that any type is allowed (equivalent
to specifying Object.class in the argument). If
the array is null, then the argument list will only
match the default (no-argument) constructor (which is the
same as setting arguments to new Class[0]).assertHasSameConstructor( String, Object, Class[], int )
,
assertHasSameConstructor( String, Class, Class[] )
,
assertHasConstructor( String, Object, Class[] )
public static void assertHasSameConstructor(java.lang.Object o, java.lang.Class[] arguments)
arguments
- list of classes which the constructor must have
as parameters, or subclasses of the arguments. A null
argument index indicates that any type is allowed (equivalent
to specifying Object.class in the argument). If
the array is null, then the argument list will only
match the default (no-argument) constructor (which is the
same as setting arguments to new Class[0]).assertHasSameConstructor( Object, Class[], int )
,
assertHasSameConstructor( Class, Class[] )
,
assertHasConstructor( Object, Class[] )
public static java.lang.reflect.Constructor getConstructor(java.lang.Class c, java.lang.Class[] arguments, int protection)
arguments
- list of classes which the constructor must have
as parameters, or subclasses of the arguments. A null
argument index indicates that any type is allowed (equivalent
to specifying Object.class in the argument). If
the array is null, then the argument list will only
match the default (no-argument) constructor (which is the
same as setting arguments to new Class[0]).protection
- a bitwise ORed value containing one or more of the
constants PUBLIC, PROTECTED, PACKAGE,
or PRIVATE.getSameConstructor( Class, Class[], int )
public static java.lang.reflect.Constructor getSameConstructor(java.lang.Class c, java.lang.Class[] arguments, int protection)
protection
- a bitwise ORed value containing one or more of the
constants PUBLIC, PROTECTED, PACKAGE,
or PRIVATE.Class.getConstructor( Class[] )
protected static boolean isInheritedParameters(java.lang.reflect.Constructor cntr, java.lang.Class[] arguments)
protected static boolean hasCorrectProtection(java.lang.reflect.Constructor cntr, int protection)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |