Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MapperTest classes do not contain test #24314

Closed
1 task done
jperezdelafuente opened this issue Nov 21, 2023 · 5 comments
Closed
1 task done

MapperTest classes do not contain test #24314

jperezdelafuente opened this issue Nov 21, 2023 · 5 comments

Comments

@jperezdelafuente
Copy link
Contributor

Overview of the issue

MapperTest classes do not contain test
An example of a MapperTest class generated by Jhipster:

package com.foo.service.mapper;

import org.junit.jupiter.api.BeforeEach;

class FooMapperTest {

    private FooMapper fooMapper;

    @BeforeEach
    public void setUp() {
        fooMapper = new FooMapperImpl();
    }
}

The lack of tests in these classes causes blocking code smells:
https://rules.sonarsource.com/java/RSPEC-2187/

The sonar-project.properties file contains:

sonar.issue.ignore.multicriteria = S2187,S3437,S4684,S5145,UndocumentedApi
# Rule https://rules.sonarsource.com/java/RSPEC-2187 is ignored, gatling tests are not supported by sonar
sonar.issue.ignore.multicriteria.S2187.resourceKey = src/test/java/gatling/**/*
sonar.issue.ignore.multicriteria.S2187.ruleKey = java:S2187

that rule is omitted for the Gatling package as it is not supported

Motivation for or Use Case

Avoid having code smells in that mapper test package
Achieve code coverage in mapper classes
If it is not considered a bug, perhaps these classes should contain a TODO comment and turn this issue into improvement

JHipster Version(s)

Jhipster 8.0.0

JHipster configuration
JDL definitions
 application {
  config {
    applicationType monolith,
    baseName foo,
    packageName com.foo,
    jhiPrefix gsr,
    authenticationType session,
    databaseType sql,
    devDatabaseType h2Disk,
    prodDatabaseType oracle,
    enableHibernateCache true,
    cacheProvider ehcache,
    buildTool maven,
    testFrameworks [cypress, gatling, cucumber],
    clientFramework angular,
    enableTranslation true,
    nativeLanguage es,
    languages [es, en]
  }
  entities *
}

/** Entity Foo /
entity Foo(foo) {
/
* Foo */
foo String required maxlength(20)
}

dto * with mapstruct
service all with serviceImpl
paginate all with pagination

  • Checking this box is mandatory (this is just to show you read everything)
@mshima
Copy link
Member

mshima commented Nov 21, 2023

@jperezdelafuente can you contribute with a PR?

@jperezdelafuente
Copy link
Contributor Author

@mshima I just wanted to report this issue.

@jperezdelafuente
Copy link
Contributor Author

Related to: #25151

@DanielFran
Copy link
Member

@jperezdelafuente The tests have been implemented.
Is it missing anything or this can be closed?

@jperezdelafuente
Copy link
Contributor Author

could be closed

@deepu105 deepu105 added this to the 8.2.0 milestone Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants