Skip to content

[java] Separate test sources and resources #5746

@oowekyala

Description

@oowekyala

Is your feature request related to a problem? Please describe.
The test tree of pmd-java has some classes that are not functional code, but that we put there so that it gets compiled and then we can use the compiled classes in tests. This code is test data, and should be separate from the actual test sources. If we separate them then we can run more static analysis on our test sources and keep that part of the codebase cleaner.

Describe the solution you'd like
Create a new source tree pmd-java/src/test/java-resources, and let it be compiled by javac. pmd-java/src/test/java should have a dependency on those. Move the test data files there.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context #5738 found a couple instances of UnusedPrivateMethod that we should legitimately fix. The rule is not used on our test sources precisely because they're mixed with the test data code, and legit violations could be mixed with bogus violations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    an:enhancementAn improvement on existing features / rulesin:testingAbout tests of pmd, eg the module pmd-lang-test or pmd-test [test]

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions