Skip to content

Unify test resources #190

@nedtwigg

Description

@nedtwigg

Testing a FormatterStep often involves test resources similar to the following:

  • java/eclipse/format/JavaCodeUnformatted.test
  • java/eclipse/format/JavaCodeFormatted.test
  • java/eclipse/format/formatter.properties

The location of these resources is currently unpredictable and sometimes duplicated. This is how it works right now:

  • if the FormatterStep lives in lib, then the test resources are in testlib/src/test/resources
  • if the FormatterStep lives in lib-extra, then the test resources are in lib-extra/src/test/resources
  • if we're doing an integration test for gradle or maven, then we copy those files into plugin-gradle/src/test/resources, where they will likely rot.

In the future, I think that we ought to make the following changes:

  • move testlib/src/test/resources to testlib/src/main/resources
  • move lib-extra/src/test/resources to testlib/src/main/resources/extra
  • delete all FormatterStep-specific test resources from plugin-gradle and plugin-maven, because we can grab them instead from testlib.

The downside to this is that testlib will get ~100kb bigger, and have some published content that's really just for testing. The upside is that testlib is really just for testing Spotless steps and plugins anyway, and it will reduce duplication and rot.

This is a super-merge-conflict-y kind of change, so I'll do it all at once after the maven-plugin branch is merged. I think there might be a related opportunity to merge integration tests between gradle and maven, so that we can generate the feature-matrix semi-automatically:

image

This isn't a pressing change - feel free to contribute whatever PR's you have as-is, using the existing schema. At some point in the future I'll send in this mega-merge. If you've got objections, feel free to speak up, lots of time :)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions