protobuf-maven-plugin icon indicating copy to clipboard operation
protobuf-maven-plugin copied to clipboard

[Chore]: improve unit test coverage

Open ascopes opened this issue 2 months ago • 0 comments

Brief description

I want to ensure our unit test coverage is as high as possible. Until now, some more complicated logic has relied on integration tests for coverage, but this can make testing bugfixes such as that in GHSA-J2PC-V64R-MV4F into a big chore.

Aims and goals

  • Can we separate coverage by unit and integration on Codecov?
  • Set up tests for the following components:
  • [ ] protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/dependencies/aether/AetherResolverTest.java
  • [x] protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/generation/LanguageTest.java
  • [ ] protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/generation/OutputDescriptorAttachmentRegistrarTest.java
  • [ ] protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/generation/ProtobufBuildOrchestratorTest.java
  • [ ] protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/generation/SourceRootRegistrarTest.java
  • [ ] protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/plugins/BinaryPluginResolverTest.java
  • [ ] protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/plugins/JvmPluginResolverTest.java
  • [ ] protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/protoc/ProtocExecutorTest.java
  • [ ] protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/protoc/ProtocResolverTest.java
  • [ ] protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/protoc/targets/SanctionedExecutableTransformerTest.java
  • [ ] protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/sources/ProjectInputListingTest.java
  • [ ] protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/sources/ProjectInputResolverTest.java
  • [ ] protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/sources/ProtoSourceResolverTest.java
  • [ ] protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/sources/incremental/IncrementalCacheManagerTest.java
  • [ ] protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/sources/incremental/IncrementalCacheTest.java

List compiled by the following script snippet before being manually filtered to remove classes with no actual logic to test:

find protobuf-maven-plugin/src/main/java -name "*.java" -print \
    | grep -vE '.*/package-info.java' 
    | sed -E 's#src/main#src/test#g;s/(.*)\.java/\1Test.java/g' \
    | while read -r file; do [[ -f ${file} ]] || echo "${file}"; done \
    | sort

ascopes avatar Nov 04 '25 07:11 ascopes