Arjun
Arjun

Reputation: 1262

JHIpster:EmployeeMapperImpl cannot be resolved to a type error in mapperTest class

I'm learning JHIpster, I've created a project and I'm able to run it from the terminal using mvn command.But I'm getting error when open the project in eclipse ,I have created just one entity named employee and Im getting the error EmployeeMapperImpl cannot be resolved to a type in EmployeeMapperTest.java class

jdl file

    /**
     * The Employee entity.
     */
    entity Employee {
        /**
        * The firstname attribute.
        */
        Name String,
        firstName String,
        lastName String,
        email String,
        phoneNumber String,
        hireDate Instant,
        salary Long,
        commissionPct Long
    }
    relationship ManyToMany{
        Employee{manager} to Employee{subordinate}
    }
paginate * with pagination
service all with serviceImpl
dto * with mapstruct

EmployeeMapperTest.java

    package com.mycompany.myapp.service.mapper;

    import org.junit.jupiter.api.BeforeEach;
    import org.junit.jupiter.api.Test;
    import static org.assertj.core.api.Assertions.assertThat;


    public class EmployeeMapperTest {

        private EmployeeMapper employeeMapper;

        @BeforeEach
        public void setUp() {
//This line causes the error
            employeeMapper = new EmployeeMapperImpl();
        }

        @Test
        public void testEntityFromId() {
            Long id = 2L;
            assertThat(employeeMapper.fromId(id).getId()).isEqualTo(id);
            assertThat(employeeMapper.fromId(null)).isNull();
        }
    }

I dont see any MapperImpl class in my JHipster project,Have I missed something in my JDL file? how to solve this issue?

Upvotes: 0

Views: 685

Answers (2)

Pierre Taquet
Pierre Taquet

Reputation: 101

Question asked a while ago, but I give an answer in case someone else got this issue.

The problem doesn't come from the JDL, the IDE must be configured properly to handle mapstruct and java annotation processing.

Just follow these steps described in documentation Configuring your IDE

Upvotes: 0

itsmarwen
itsmarwen

Reputation: 131

You can find that class under : ..\src\ test \java\org\junit\jupiter\service\mapper ;)

Upvotes: 0

Related Questions