-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test for appended exception #136
Conversation
Fixed test so that the test should be green 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding a test to reproduce the issue you're having. Oddly enough the test passes, so now we need to figure out what's different in your scenario. 🤔
src/test/java/org/openrewrite/java/logging/ParameterizedLoggingTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/openrewrite/java/logging/ParameterizedLoggingTest.java
Outdated
Show resolved
Hide resolved
Even with this test it passes, even though that very closely matches: https://github.com/JabRef/jabref/blob/b7990ea3e80eae4ab7cc8cf8d508fea5d2e0ebe8/src/main/java/org/jabref/gui/FallbackExceptionHandler.java#L12 @Test
@Issue("https://github.com/openrewrite/rewrite/issues/4054")
void exceptionAppended() {
rewriteRun(
spec -> spec.recipeFromResources("org.openrewrite.java.logging.slf4j.ParameterizedLogging"),
//language=java
java(
"""
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
class Foo {
private static final Logger logger = LoggerFactory.getLogger(Foo.class);
static void method(Class<?> clazz, IllegalAccessException ex) {
logger.error("Cannot instantiate dependency: " + clazz, ex);
}
}
""",
"""
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
class Foo {
private static final Logger logger = LoggerFactory.getLogger(Foo.class);
static void method(Class<?> clazz, IllegalAccessException ex) {
logger.error("Cannot instantiate dependency: {}", clazz, ex);
}
}
"""
)
);
} |
…gTest.java Co-authored-by: Tim te Beek <[email protected]>
…gTest.java Co-authored-by: Tim te Beek <[email protected]>
Yeah, this is the strange thing. Running the recipe in the moderne plattform results in 0 updates. Think, the reason is somewhere else. openrewrite/rewrite#4054 needs to be investigated further. |
Looks like we already had a very similar test for this; rather than duplicate I've moved the |
Turns out the issue is caused by missing type information, as explored through the platform: |
It's OK for me. I personally like to have more tests than less tests. It could be that someone modifies the logic in the future so that the two tests cover different things. |
This refs openrewrite/rewrite#4054, but contributes only a small portion of the issue in question.
What's changed?
Test added for checking rewrite of
to