You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Access to the Filer is trivial to add to CompilationRule. What I can't figure out is how to propagate the generated content back to the test to assert on the generated sources. At the very least it would require a change to Compilation to inject the InMemoryJavaFileManager so it could also be made available to the test but that brings other dependencies with it. Perhaps Compilation should be more stateful than just static helpers?
I'm not doing any actual compilation. I want to only test interactions with a Filer and assert on its outputs.
Happy to implement, just want guidance/approval on the approach.
The text was updated successfully, but these errors were encountered:
Yes, that's totally the right way to go. If you are just testing the filer, make a fake filer - getting the one from CompilationRule is a little weird anyway since that's all part of a fake compilation that actually encloses the test. If you're on 1.7+, JavacPathFileManager and Jimfs are definitely preferred to my semi-hacky implementation.
do you have a working example of this ? I don't only want to compile the generated code, I would also like to execute it (load it into memory, even if by reflection).
Follows up #70
Access to the
Filer
is trivial to add toCompilationRule
. What I can't figure out is how to propagate the generated content back to the test to assert on the generated sources. At the very least it would require a change toCompilation
to inject theInMemoryJavaFileManager
so it could also be made available to the test but that brings other dependencies with it. PerhapsCompilation
should be more stateful than just static helpers?I'm not doing any actual compilation. I want to only test interactions with a
Filer
and assert on its outputs.Happy to implement, just want guidance/approval on the approach.
The text was updated successfully, but these errors were encountered: