convert dropwizard-views-0.7 tests from groovy to java#8808
Conversation
| package io.opentelemetry.javaagent.instrumentation.dropwizardviews; /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ |
There was a problem hiding this comment.
| package io.opentelemetry.javaagent.instrumentation.dropwizardviews; /* | |
| * Copyright The OpenTelemetry Authors | |
| * SPDX-License-Identifier: Apache-2.0 | |
| */ | |
| package io.opentelemetry.javaagent.instrumentation.dropwizardviews; |
|
|
||
| @AfterEach | ||
| void cleanUp() { | ||
| testing.clearData(); |
There was a problem hiding this comment.
This allows each of the iterations of the test to start with a clean slate rather than a trace with other spans that had been created by previous test interfering. Taking that part out causes every test after the first one to fail.
There was a problem hiding this comment.
Perhaps this is so because you have not added @RegisterExtension annotation on InstrumentationExtension field?
| () -> { | ||
| renderer.render(view, Locale.ENGLISH, outputStream); | ||
| }); | ||
| assertTrue(outputStream.toString("UTF-8").contains("This is an example of a view")); |
There was a problem hiding this comment.
You could use assertj assertThat(outputStream.toString("UTF-8")).contains("This is an example of a view")
There was a problem hiding this comment.
Great recommendation. I will apply that suggestion.
|
Thanks for the tips and the quick review! |
mateuszrzeszutek
left a comment
There was a problem hiding this comment.
LGTM 👍
Thanks @quinoant !
related to #7195