From 189b6875498ad45a84780501e9f12d5d92a8b699 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Mon, 30 Oct 2023 11:25:32 -0300 Subject: [PATCH] adjusts --- .../_entityPackage_/domain/_persistClass_Test.java.ejs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/generators/java/templates/src/test/java/_package_/_entityPackage_/domain/_persistClass_Test.java.ejs b/generators/java/templates/src/test/java/_package_/_entityPackage_/domain/_persistClass_Test.java.ejs index 938b14384038..b06c5946058d 100644 --- a/generators/java/templates/src/test/java/_package_/_entityPackage_/domain/_persistClass_Test.java.ejs +++ b/generators/java/templates/src/test/java/_package_/_entityPackage_/domain/_persistClass_Test.java.ejs @@ -26,6 +26,7 @@ import static <%= otherEntity.entityAbsolutePackage %>.domain.<%= otherEntity.pe import <%= otherEntity.entityAbsolutePackage %>.domain.<%= otherEntity.persistClass %>; <%_ } _%> <%_ if (relationships.some(relationship => relationship.collection)) { _%> +import java.util.HashSet; import java.util.Set; <%_ } _%> import org.junit.jupiter.api.Test; @@ -92,7 +93,7 @@ class <%= persistClass %>Test { <%_ } _%> <%_ if (relationship.collection) { _%> - <%= persistInstance %>.set<%- relationship.propertyNameCapitalized %>(Set.of(<%= relationship.otherEntity.persistInstance %>Back)); + <%= persistInstance %>.set<%- relationship.propertyNameCapitalized %>(new HashSet<>(Set.of(<%= relationship.otherEntity.persistInstance %>Back))); assertThat(<%= persistInstance %>.get<%- relationship.propertyNameCapitalized %>()).containsOnly(<%= relationship.otherEntity.persistInstance %>Back); <%_ if (relationship.otherRelationship && !relationship.ownerSide && !relationship.otherEntity.embedded) { _%> <%_ if (relationship.otherRelationship.collection) { _%> @@ -102,7 +103,7 @@ class <%= persistClass %>Test { <%_ } _%> <%_ } _%> - <%= persistInstance %>.set<%- relationship.propertyNameCapitalized %>(Set.of()); + <%= persistInstance %>.set<%- relationship.propertyNameCapitalized %>(new HashSet<>()); assertThat(<%= persistInstance %>.get<%- relationship.propertyNameCapitalized %>()).doesNotContain(<%= relationship.otherEntity.persistInstance %>Back); <%_ if (relationship.otherRelationship && !relationship.ownerSide && !relationship.otherEntity.embedded) { _%> <%_ if (relationship.otherRelationship.collection) { _%>