I'm using lombok in my code to generate some getters so nothing out of the ordinary. I initially planned to test some custom annotations of mine, but before I get the chance to do that, lombok is making some problems.
I simplified my code to reproduce the error, this is the setup that I ended with, and which doen't work.
I have this Class that I want to test:
import lombok.Getter;
public class ExampleModelClass {
@Getter
private final String exampleStringField = "default value";
}
I want the to test the contents of the exampleStringField
, so I started with a failing test:
import borg.locutus.bukkitutils.test.utils.ExampleModelClass;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public class SqlAnnotationTest {
@Test
public void FieldContentTest() {
ExampleModelClass model = new ExampleModelClass();
assertEquals(model.getExampleStringField(), "not the default value");
}
}
In my normal jar the getter generated by lombok works fine, so I am 100% sure that the code would actually work, but junit seems not to accept it. I keep getting a cannot find symbol
error for the model.getExampleStringField()
. I guess lombok is not being executed when my tests run, but I'd really like to change that. I'm using IntelliJ Ultimate 2020 and Maven.