-
Notifications
You must be signed in to change notification settings - Fork 7
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 or remove imports #10
Conversation
for (String import_ : imports) { | ||
recipe.append(" maybeRemoveImport(\"" + import_ + "\");\n"); | ||
recipe.append(" maybeAddImport(\"" + import_ + "\");\n"); | ||
} | ||
for (String import_ : staticImports) { | ||
recipe.append(" maybeRemoveImport(\"" + import_ + "\");\n"); | ||
int dot = import_.lastIndexOf('.'); | ||
recipe.append(" maybeAddImport(\"" + import_.substring(0, dot) + "\", \"" + import_.substring(dot + 1) + "\");\n"); | ||
} |
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.
I was surprised we don't seem to separate imports, even though they end up OK into each of the before/after templates. That meant here I've had to both add and remove them maybe; which was good enough to get working, but not something that I'd be confident relying on.
Do we see any reasonable ways to unit test this stuff here? Not looking to slow us down, but it'd be slightly nicer than having to publish to maven local. |
Also quickly tried out testing in #11 |
I would prefer if we could try to instead apply |
Didn't get to a proper fix here, but we do have the tests merged into this one such that we should be able to iterate more easily. |
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.
Let's merge it. I will look more thoroughly at it next week.
Appreciate it! I've added a test to quickly capture the current behavior just now in 0073350. |
No description provided.