-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Generated java tests fails when a field has unique validation, entity has filter and is required #9666
Comments
Using the jpaDerivedIdentifier has the same result as with the required and filter: This JDL also fails
|
There may be dependencies deep into the creation tree: This JDL also fails, it has no filter nor jpaDerivedIdentifier.
|
Checks if a required entity is already created in the createEntity method, adds the creatUpdatedEntity using the UPDATED_ constants, adds the findAll method to TestUtils, Fix jhipster#9666
Checks if a required entity is already created in the createEntity method, adds the creatUpdatedEntity using the UPDATED_ constants and adds the findAll method to TestUtils. Fix jhipster#9666
Checks if a required entity is already created in the createEntity method, adds the creatUpdatedEntity using the UPDATED_ constants and adds the findAll method to TestUtils. Fix jhipster#9666
The additions I made to the app.jdl catches the behaviour: in the current version these are the errors of the app.jdl updated:
Prior to my edit, this JDL already had an warning, but it didn't result in an error. I don't know if all dependent entities should have a DTO or not.
|
I confirm the issue and can reproduce. |
Overview of the issue
Generated java tests fails when a field has unique validation and filter:
Motivation for or Use Case
The generated tests should be passing.
Reproduce the error
Create a new project with default settings
jhipster
, import JDLjhipster import-jdl bug.jdl
, run./mvnw clean install
.Related issues
It was also happening in #9563 , but I hadn't identified the cause and it was also happening with other bugs.
Suggest a Fix
The createEntity shouldn't create entities that have the same value for the field if it is unique, as it could be created twice by other entities that require it.
Another simple solution is not to create a new entity if it was already created. I will try to make a PR to fix it.
JHipster Version(s)
JHipster configuration, a
.yo-rc.json
file generated in the root folder.yo-rc.json file
JDL for the Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryEnvironment and Tools
git version 2.11.0
node: v10.15.3
npm: 6.4.1
yeoman: 2.0.6
yarn: 1.15.2
Docker version 18.09.5, build e8ff056dbc
docker-compose version 1.24.0, build 0aa59064
Browsers and Operating System
Debian 9
The text was updated successfully, but these errors were encountered: