Package org.djutils.reflection
Class ClassUtilTest
java.lang.Object
org.djutils.reflection.ClassUtilTest
The JUNIT Test for
ClassUtil.
Copyright (c) 2002-2025 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 ClassesModifier and TypeClassDescriptionstatic @interfaceannotation class with String parameter.static @interfaceannotation class.protected static classsuperclass with fields and methods.protected static classsubclass with fields and methods. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidTests the ClassUtil Annotation lookup methods.voidvoidTests the ClassUtil Constructor lookup methods.voidTests the ClassUtil Constructors.voidTests the ClassUtil Field lookup methods.voidTests the ClassUtil Method lookup methods.protected voidprotected voidvoidTest 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) voidTest the constructors and fields of the MethodSignature class.voidTest the toClass method of the FieldSignature class.voidTest the toDescriptor method of the FieldSignature class.
-
Constructor Details
-
ClassUtilTest
public ClassUtilTest()
-
-
Method Details
-
testClassUtilClass
@Test public void testClassUtilClass() -
testToDescriptor
@Test public void testToDescriptor()Test the toDescriptor method of the FieldSignature class. -
testToClass
Test the toClass method of the FieldSignature class.- Throws:
ClassNotFoundException- if that happens uncaught; this test has failed
-
testFieldSignature
Test the constructors and fields of the FieldSignature class.- Throws:
ClassNotFoundException- if that happens uncaught; this test has failed
-
testMethodSignature
@Test 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
@Test 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
@Test 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
Tests the ClassUtil Field lookup methods.- Throws:
NoSuchFieldException- on error
-
testClassUtilMethod
Tests the ClassUtil Method lookup methods.- Throws:
NoSuchMethodException- on error
-
testClassUtilAnnotation
@Test 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
-