Package org.djutils.reflection
Class ClassUtilTest
- java.lang.Object
-
- org.djutils.reflection.ClassUtilTest
-
public class ClassUtilTest extends Object
The JUNIT Test forClassUtil
.Copyright (c) 2002-2023 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html.
- Author:
- Peter Jacobs , Peter Knoppers
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ClassUtilTest.AnnString
annotation class with String parameter.static interface
ClassUtilTest.AnnTag
annotation class.protected static class
ClassUtilTest.Sub
superclass with fields and methods.protected static class
ClassUtilTest.Sup
subclass with fields and methods.
-
Constructor Summary
Constructors Constructor Description ClassUtilTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
testClassUtilAnnotation()
Tests the ClassUtil Annotation lookup methods.void
testClassUtilClass()
void
testClassUtilConstructor()
Tests the ClassUtil Constructor lookup methods.void
testClassUtilConstructors()
Tests the ClassUtil Constructors.void
testClassUtilField()
Tests the ClassUtil Field lookup methods.void
testClassUtilMethod()
Tests the ClassUtil Method lookup methods.protected void
testField(Class<?> clazz, String fieldName, int... modifiers)
protected void
testField(Object object, String fieldName, int... modifiers)
void
testFieldSignature()
Test the constructors and fields of the FieldSignature class.protected void
testMethod(Class<?> clazz, String methodName, Class<?>[] params, int... modifiers)
protected void
testMethod(Object object, String methodName, Class<?>[] params, int... modifiers)
protected void
testMethod(Object object, String methodName, Object[] args, int... modifiers)
void
testMethodSignature()
Test the constructors and fields of the MethodSignature class.void
testToClass()
Test the toClass method of the FieldSignature class.void
testToDescriptor()
Test the toDescriptor method of the FieldSignature class.
-
-
-
Method Detail
-
testClassUtilClass
public void testClassUtilClass()
-
testToDescriptor
public void testToDescriptor()
Test the toDescriptor method of the FieldSignature class.
-
testToClass
public void testToClass() throws ClassNotFoundException
Test the toClass method of the FieldSignature class.- Throws:
ClassNotFoundException
- if that happens uncaught; this test has failed
-
testFieldSignature
public void testFieldSignature() throws ClassNotFoundException
Test the constructors and fields of the FieldSignature class.- Throws:
ClassNotFoundException
- if that happens uncaught; this test has failed
-
testMethodSignature
public void testMethodSignature() throws NoSuchMethodException, SecurityException, ClassNotFoundException
Test the constructors and fields of the MethodSignature class.- Throws:
SecurityException
- if that happens uncaught; this test has failedNoSuchMethodException
- if that happens uncaught; this test has failedClassNotFoundException
- if that happens uncaught; this test has failed
-
testClassUtilConstructors
public void testClassUtilConstructors() throws NoSuchMethodException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
Tests the ClassUtil Constructors.- Throws:
NoSuchMethodException
- on errorInvocationTargetException
- on errorIllegalArgumentException
- on errorIllegalAccessException
- on errorInstantiationException
- on error
-
testClassUtilConstructor
public void testClassUtilConstructor() throws NoSuchMethodException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
Tests the ClassUtil Constructor lookup methods.- Throws:
NoSuchMethodException
- on errorInvocationTargetException
- on errorIllegalArgumentException
- on errorIllegalAccessException
- on errorInstantiationException
- on error
-
testClassUtilField
public void testClassUtilField() throws NoSuchFieldException
Tests the ClassUtil Field lookup methods.- Throws:
NoSuchFieldException
- on error
-
testClassUtilMethod
public void testClassUtilMethod() throws NoSuchMethodException
Tests the ClassUtil Method lookup methods.- Throws:
NoSuchMethodException
- on error
-
testClassUtilAnnotation
public void testClassUtilAnnotation()
Tests the ClassUtil Annotation lookup methods.
-
testField
protected void testField(Class<?> clazz, String fieldName, int... modifiers) throws NoSuchFieldException
- Parameters:
clazz
- the class to testfieldName
- the field to retrievemodifiers
- the expected modifiers- Throws:
NoSuchFieldException
- on error
-
testField
protected void testField(Object object, String fieldName, int... modifiers) throws NoSuchFieldException
- Parameters:
object
- the object to testfieldName
- the field to retrievemodifiers
- the expected modifiers- Throws:
NoSuchFieldException
- on error
-
testMethod
protected void testMethod(Class<?> clazz, String methodName, Class<?>[] params, int... modifiers) throws NoSuchMethodException
- Parameters:
clazz
- the class to testmethodName
- the method to retrieveparams
- the parameters of the method as a class arraymodifiers
- the expected modifiers- Throws:
NoSuchMethodException
- on error
-
testMethod
protected void testMethod(Object object, String methodName, Class<?>[] params, int... modifiers) throws NoSuchMethodException
- Parameters:
object
- the object to testmethodName
- the method to retrieveparams
- the parameters of the method as a class arraymodifiers
- the expected modifiers- Throws:
NoSuchMethodException
- on error
-
testMethod
protected void testMethod(Object object, String methodName, Object[] args, int... modifiers) throws NoSuchMethodException
- Parameters:
object
- the object to testmethodName
- the method to retrieveargs
- the parameters of the method as an object arraymodifiers
- the expected modifiers- Throws:
NoSuchMethodException
- on error
-
-