Skip to content

Conversation

vlsi
Copy link

@vlsi vlsi commented Oct 10, 2021

fixes #1720

@junit-builds
Copy link
Contributor

JUnit 4 is now in maintenance mode.

At this point, only critical bugs and security issues will be fixed.

The team has therefore decided to close this PR.

@vlsi
Copy link
Author

vlsi commented May 30, 2025

@junit-builds , can you please reconsider?

The issue blocks Testcontainers from dropping junit4 runtime dependency since this specific validation enforces that the field has to be junit4's Rule.

It is extremely annoying that Testcontainers has to bring junit4 dependency even though I do not need it. It is bad it results in multiple @Test annotations on the classpath.

What is your suggestion for testcontainers/testcontainers-java#970 then?

@kcooney
Copy link
Member

kcooney commented May 30, 2025

What is your suggestion for testcontainers/testcontainers-java#970 then?

Multiple suggestions were made in #1720

I think the best approach would be to split testcontainers into multiple libraries, one with the "core" code, and one for each test library that testcontainers supports (see #1720 (comment))

*/
private static final class FieldMustBeARule implements RuleValidator {
public void validate(FrameworkMember<?> member, Class<? extends Annotation> annotation, List<Throwable> errors) {
if (true) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (true) {
// Comentario explicativo
return;
}
// Esta validación nunca se ejecuta
if (!isRuleType(member)) {
errors.add(new ValidationError(member, annotation,
"must implement MethodRule or TestRule."));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validate actual rule object instead of Field#type for @Rule
4 participants