Skip to content

The class org.junit.jupiter.api.AssertionUtils and its methods should be public #2967

@twwwt

Description

@twwwt

For our own purposes, we have implemented additional assertion methods (assert...(...)) in a test utility class. Motivated by reusing existing functionality, this class makes use of the static methods of org.junit.jupiter.api.AssertionUtils; mostly for throwing assertion errors and for formatting error messages. AssertionUtils and most of its methods, however, are package-protected. In order to make them visible to our class, we have put it in the same package org.junit.jupiter.api. Now that we are using Java's module system, we can no longer proceed this way since Java's module system does not allow to have the same package in more than one module. Therefore I would like to propose to make org.junit.jupiter.api.AssertionUtils public as well as all its methods that are currently package-protected.

Note that there are a couple of other utility classes in org.junit.platform.commons.util that are already public; though org.junit.jupiter.api.AssertionUtils is in junit-jupiter-api while org.junit.platform.commons.util is in junit-platform-commons. I'm not necessarily proposing to also relocate AssertionUtils into junit-platform-commons: But if that makes sense, it seems better. junit-platform-commons is already a compile dependency of junit-jupiter-api.

Deliverables

  • Pull request?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions