0

I just try to get used to Lombok but have already a problem.

I used that http://www.baeldung.com/intro-to-project-lombok and another tutorial but these and google cannot help.

My classes:

package springprojekt;

import lombok.Data;
import lombok.RequiredArgsConstructor;

import java.io.Serializable;
import java.util.concurrent.atomic.AtomicInteger;
@Data
@RequiredArgsConstructor
public class Person implements Serializable {

    private static AtomicInteger idGenerator = new AtomicInteger();

    private final String firstName;
    private final String lastName;
    private final int id;


    public Person(String firstName, String lastName) {
        this.firstName = firstName;
        this.lastName = lastName;
        id = idGenerator.getAndIncrement();
    }
}

and my test

package springprojekt;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
public class DemoApplicationTests {

    @Test
    public void contextLoads() {
        Person person = new Person("Max", "Peter");
    }

}

I understood that lombok creates getter and setter (in that case not applicable) for me. I actually want access in that test like person.getFirstName() But my IDE (IntelliJ Ultimate) denies to work because there is no matching method. So how can I test it please? Or did I do anything wrong?

PowerFlower
  • 1,619
  • 4
  • 18
  • 27

0 Answers0