Skip to content

Expose more functionality from package org.junit.platform.commons.util #2995

@robtimus

Description

@robtimus

I have some assertions and extensions. These use some of the functionality from package org.junit.platform.commons.util. Now I'm trying to upgrade to Java 11, but that package is only exported to a select set of JUnit modules. That makes it hard to achieve some functionality. I have switched to using classes like AnnotationSupport instead of AnnotationUtils and ReflectionSupport instead of ReflectionUtils, but not all is exposed through other classes.

Functionality I'm still using from org.junit.platform.commons.util:

  • ReflectionUtils.parseFullyQualifiedMethodName and ReflectionUtils.getRequiredMethod for functionality similar to @MethodSource.
    • There is ReflectionSupport.findMethod, but perhaps adding these two methods could also be done.
  • ExceptionUtils.throwAsUncheckedException for simplified error handling.
    • Note that this method is part of documentation, for example see Assumptions.assumingThat or ThrowableCollector.assertEmpty.

The methods from ReflectionUtils are easy enough to achieve - just copy them to ReflectionSupport. That's also done for findMethod and other methods. For ExceptionUtils, perhaps a class ExceptionSupport can be added in org.junit.platform.commons.support.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions