Skip to content

Drop redundant Matchers.{allOf,anyOf} containing a single Matcher #340

@oxkitsune

Description

@oxkitsune

Problem

Declaring a Matcher using Matchers.{allOf,anyOf}(Matcher...) containing just a single Matcher, is redundant.

Description of the proposed new feature

  • Support a stylistic preference.
  • Avoid a common gotcha, or potential problem.

We can rewrite

allOf(annotations(AT_LEAST_ONE, isType("org.junit.jupiter.params.provider.MethodSource")));
anyOf(annotations(AT_LEAST_ONE, isType("org.junit.jupiter.params.provider.MethodSource")));

to:

annotations(AT_LEAST_ONE, isType("org.junit.jupiter.params.provider.MethodSource"));
annotations(AT_LEAST_ONE, isType("org.junit.jupiter.params.provider.MethodSource"));

Considerations

This should support the method overloads Matchers.{allOf,anyOf}(Iterable<? extends Matcher>).

Participation

This is a nice opportunity to get your hands dirty with BugCheckers 🚀

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions