Book-Microservices-v2/chapter03

The constructor Challenge(int, int) is undefined

Closed this issue · 2 comments

When I am running the test, I am getting this error:

The constructor Challenge(int, int) is undefined

It is caused by this line of code inside ChallengeGeneratorServiceTest

then(challenge).isEqualTo(new Challenge(31, 41));

It is possible to solve the issue by explicitly adding a constructor which accepts two int values to the Challenge class:

`package microservices.book.multiplication.challenge;

import lombok.*;

/**

  • This class represents a Challenge to solve a Multiplication (a * b).
    */
    @Getter
    @tostring
    @EqualsAndHashCode
    @AllArgsConstructor
    public class Challenge {
    private int factorA;
    private int factorB;

    public Challenge(int i, int j) {
    this.factorA = i;
    this.factorB = j;
    }
    }`

However, as we use the @AllArgsConstructor of Lombock it should not be necessary to add this constructor. Am I missing something?

Hey @wagenbm,

Try comparing the implementation in the last updated version with yours.

Or perhaps they changed something recently in Lombok and you are using a newer version. I'd need to check that. Do you have your code available publicly on GitHub?

Hey @wagenbm,

Try comparing the implementation in the last updated version with yours.

Or perhaps they changed something recently in Lombok and you are using a newer version. I'd need to check that. Do you have your code available publicly on GitHub?

Hi,

The issue was myself: I missed the fact, that I had to re-install Eclipse. I had to install the Lombok plug-in again. As this was missing it did not work.

Kind regards,
Matthias