sockeqwe sockeqwe - 10 months ago 52
Java Question

Truth.assertAbout and JavaSourceSubjectFactory.javaSource()

I'm writing an annotation processor and want to write some unit tests for it by using


So I want to write a very simple unit test.

import static;
import static;

public void componentOnConcreteClass() {
JavaFileObject componentFile = JavaFileObjects.forSourceLines("test.NotAClass",
"package test;",
"import my.annotation.MyAnnotation;",
"interface NotAComponent {}");
.processedWith(new MyProcessor())

So basically I have copy an pasted a simple test from google's dagger2 repo and replaced the relevant data with my annotation processor.
I'm using maven, and I'm using the same dependencies as dagger2:


But I can't compile the code. I guess there is an generics param problem, but can't figure out what the problem is.

Compilation failure:
[ERROR][46,5] method assertAbout in class cannot be applied to given types;
[ERROR] required:<S,T>
[ERROR] found:
[ERROR] reason: no instance(s) of type variable(s) S,T exist so that argument type conforms to formal parameter type<S,T>

Any hint what I'm doing wrong? I can't find any difference to google dagger2 tests (which by the way compiles on my machine)


The artifact depends on org.truth0:truth:0.15 which is the old location of Truth. Try using version 0.6 of compile-testing instead.