AssertionError when unit testing an annotation processor with compile-testing <p>Google's <a href="https://github.com/google/compile-testing" rel="nofollow">compile-testing</a> is a great tool when it comes to unit testing annotation processors. Unfortunately I'm currently facing the following error:</p> <pre><code>java.lang.AssertionError: An expected source declared one or more top-level types that were not present. Expected top-level types: &lt;[test.LocalStorage]&gt; Declared by expected file: &lt;LocalStorageImpl.java&gt; The top-level types that were present are as follows: - [test.LocalStorageImpl] in &lt;/SOURCE_OUTPUT/test/LocalStorageImpl.java&gt; </code></pre> <p>My processor generates the implementation of an annotated interface. So the generated code has a dependency to the interface (<code>class LocalStorageImpl implements LocalStorage</code>).</p> <p>When I try to verify the generated code with</p> <pre><code> JavaFileObject source = /* interface definition */ JavaFileObject expected_source = /* the generated implementation */ assertAbout(javaSource()).that(source) .processedWith(new MyProcessor()) .compilesWithoutError() .and() .generatesSources(expectedSource); </code></pre> <p>...the <code>generatesSource</code> causes the error. As the error message states, it cannot resolve the interface definition.</p> <p><strong>So my question is how to compile or write the source file of the interface defined in <code>source</code>, so that it is recognized by <code>generatesSources()</code>?</strong></p>