New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assertions for java.lang.reflect #3130
Comments
wjbakker
pushed a commit
to wjbakker/assertj-core
that referenced
this issue
Jul 31, 2023
This changes adds assertions for classes: * Field * Method * Constructor
wjbakker
pushed a commit
to wjbakker/assertj-core
that referenced
this issue
Jul 31, 2023
This changes adds assertions for classes: * Field * Method * Constructor Improve javadoc.
Thanks a lot for putting together such a summary, @wjbakker. It makes totally sense to move in this direction. |
wjbakker
pushed a commit
to wjbakker/assertj-core
that referenced
this issue
Aug 1, 2023
This changes adds assertions for classes: * Field * Method * Constructor Fix binary compatibility for ShouldHaveAnnotations Improve Javadoc in AbstractMethodAssert
wjbakker
pushed a commit
to wjbakker/assertj-core
that referenced
this issue
Aug 1, 2023
This changes adds assertions for classes: * Field * Method * Constructor Formatting
Do we have any progress, here? Thanks. |
I did not follow it so not much on my side, @scordio is that something you have looked into ? |
Not in detail but I plan to as soon as we start focusing on 3.26.0. |
Why don't we go with following signatures? hasAnyAnnotation(final Class<?> annotation, final Class<?>... otherAnnotations);
doesNotHasAnyAnnotation(final Class<?> annotation, final Class<?>... otherAnnotations);
hasAllAnnotations(final Class<?> annotation, final Class<?>... otherAnnotations); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Feature summary
Add assertions for classes in the
java.lang.reflect
package:Field
Method
Constructor
In this issue, we will add support for visiblity modifiers, static / final modifiers and annotations:
isPublic()
,isProtected()
,isPackagePrivate()
hasAnnotation(Class)
,hasAnnotations(Class...)
isAbstract()
,isStatic()
,isNotStatic()
,isFinal()
,isNotFinal()
isStatic()
,isNotStatic()
,isFinal()
,isNotFinal()
isPublic()
isProtected()
isPackagePrivate()
hasAnnotation(Class)
hasAnnotations(Class...)
isStatic()
isNotStatic()
isFinal()
isNotFinal()
isAbstract()
Example
Limitations / Future considerations
Field
,Method
andConstructor
are covered in this issue. Further features can be added in later issues.java.lang.reflect
package are covered in this issue. Support forParameter
can be added in later issues.Field
,Method
andConstructor
. In later iterations, we could consider adding a method toClassAssert
to extract members, so one can navigate fluently to theField
,Method
andConstructor
. This is left out of scope as it requires further thought about visibility, exceptions and method overloading. For example:Assertions
andBDDAssertions
entry points are very large. We could introduce an interface with static methods for the assertion methods related to thejava.lang.reflect
package and implement this interface in theAssertions
entry point.See also:
The text was updated successfully, but these errors were encountered: