Package org.djutils.reflection
Class ClassUtilTest
java.lang.Object
org.djutils.reflection.ClassUtilTest
The JUNIT Test for
ClassUtil
.
Copyright (c) 2002-2024 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
Modifier and TypeClassDescriptionstatic @interface
annotation class with String parameter.static @interface
annotation class.protected static class
superclass with fields and methods.protected static class
subclass with fields and methods. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Tests the ClassUtil Annotation lookup methods.void
void
Tests the ClassUtil Constructor lookup methods.void
Tests the ClassUtil Constructors.void
Tests the ClassUtil Field lookup methods.void
Tests the ClassUtil Method lookup methods.protected void
protected void
void
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
Test the constructors and fields of the MethodSignature class.void
Test the toClass method of the FieldSignature class.void
Test 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
-