However, in all my tests, the import statement for
MoreObjects
is not being added. Can anyone explain why?
I was running into something similar tonight. I would say try using the fully qualified name in the JavaTemplate, so that maybeAddImport()
detects the usage correctly. That worked me!
JavaTemplate template = JavaTemplate.builder("com.google.common.base.MoreObjects.toStringHelper(#{any()})")
.build();