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 interfaceClassUtilTest.AnnStringannotation class with String parameter.static interfaceClassUtilTest.AnnTagannotation class.protected static classClassUtilTest.Subsuperclass with fields and methods.protected static classClassUtilTest.Supsubclass with fields and methods.
-
Constructor Summary
Constructors Constructor Description ClassUtilTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidtestClassUtilAnnotation()Tests the ClassUtil Annotation lookup methods.voidtestClassUtilClass()voidtestClassUtilConstructor()Tests the ClassUtil Constructor lookup methods.voidtestClassUtilConstructors()Tests the ClassUtil Constructors.voidtestClassUtilField()Tests the ClassUtil Field lookup methods.voidtestClassUtilMethod()Tests the ClassUtil Method lookup methods.protected voidtestField(Class<?> clazz, String fieldName, int... modifiers)protected voidtestField(Object object, String fieldName, int... modifiers)voidtestFieldSignature()Test the constructors and fields of the FieldSignature class.protected voidtestMethod(Class<?> clazz, String methodName, Class<?>[] params, int... modifiers)protected voidtestMethod(Object object, String methodName, Class<?>[] params, int... modifiers)protected voidtestMethod(Object object, String methodName, Object[] args, int... modifiers)voidtestMethodSignature()Test the constructors and fields of the MethodSignature class.voidtestToClass()Test the toClass method of the FieldSignature class.voidtestToDescriptor()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 ClassNotFoundExceptionTest the toClass method of the FieldSignature class.- Throws:
ClassNotFoundException- if that happens uncaught; this test has failed
-
testFieldSignature
public void testFieldSignature() throws ClassNotFoundExceptionTest 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, ClassNotFoundExceptionTest 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, InvocationTargetExceptionTests the ClassUtil Constructors.- Throws:
NoSuchMethodException- on errorInvocationTargetException- on errorIllegalArgumentException- on errorIllegalAccessException- on errorInstantiationException- on error
-
testClassUtilConstructor
public void testClassUtilConstructor() throws NoSuchMethodException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetExceptionTests the ClassUtil Constructor lookup methods.- Throws:
NoSuchMethodException- on errorInvocationTargetException- on errorIllegalArgumentException- on errorIllegalAccessException- on errorInstantiationException- on error
-
testClassUtilField
public void testClassUtilField() throws NoSuchFieldExceptionTests the ClassUtil Field lookup methods.- Throws:
NoSuchFieldException- on error
-
testClassUtilMethod
public void testClassUtilMethod() throws NoSuchMethodExceptionTests 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
-
-