Convert remaining declarative config factory tests to parameterized test#8460
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8460 +/- ##
============================================
+ Coverage 91.00% 91.02% +0.01%
- Complexity 7817 7819 +2
============================================
Files 893 893
Lines 23721 23721
Branches 2364 2364
============================================
+ Hits 21588 21592 +4
+ Misses 1410 1408 -2
+ Partials 723 721 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jkwatson
left a comment
There was a problem hiding this comment.
subtract 600 lines of code and not drop the test coverage? I approve.
| cleanup.addCloseables(closeables); | ||
|
|
||
| assertThat(processor.toString()).isEqualTo(expectedProcessor.toString()); | ||
| private static Stream<Arguments> createTestCases() { |
There was a problem hiding this comment.
A small improvement that could be made to the parameterized tests is the use of named arguments.
They increase readability (especially when the test arguments are similar) by associating a string with the argument payload. This would help determine the initial purpose of the different test cases (especially when the arguments are complex objects) when re-visiting the tests later to add/edit test cases.
Arguments.of(
Named.of(
"SpanProcessorModel with OTLP",
new SpanProcessorModel()
.withBatch(
new BatchSpanProcessorModel()
.withExporter(
new SpanExporterModel().withOtlpHttp(new OtlpHttpExporterModel()))),
BatchSpanProcessor.builder(
OtlpHttpSpanExporter.builder().setComponentLoader(context).build())
.build()),
...There was a problem hiding this comment.
Yeah! I should get in the habit of using named arguments more often. I always forget they're there.
There was a problem hiding this comment.
Went with this new junit API, argumentSet, which doesn't require an another layer of wrapping. Will followup with guidance in https://github.com/open-telemetry/opentelemetry-java/blob/main/docs/knowledge/testing-patterns.md
Arguments.argumentSet(
"otlp_grpc default",
…est (open-telemetry#8460) Signed-off-by: Hilmar Falkenberg <hilmar.falkenberg@sap.com>
No description provided.