From ae4996c9db47126662c676ea81abc71d86494f7c Mon Sep 17 00:00:00 2001 From: Mauricio Uyaguari Date: Thu, 5 Sep 2024 09:47:59 -0400 Subject: [PATCH] add java keyword test --- .../junit/TestJUnitTestGeneratorCompilation.java | 7 +++++++ .../TestJUnitTestGeneratorSerialization.java | 15 ++++++++++++--- .../test/resources/entities/model/mapping/_.json | 10 ++++++++++ .../resources/entities/model/mapping/public.json | 10 ++++++++++ .../generated/java/model/mapping/Test__.java | 12 ++++++++++++ .../generated/java/model/mapping/Test_public.java | 12 ++++++++++++ .../test/junit/junit4/model/mapping/Test__.java | 12 ++++++++++++ .../junit/junit4/model/mapping/Test_public.java | 12 ++++++++++++ .../java/other/test/pkg/model/mapping/Test__.java | 12 ++++++++++++ .../other/test/pkg/model/mapping/Test_public.java | 12 ++++++++++++ 10 files changed, 111 insertions(+), 3 deletions(-) create mode 100644 legend-sdlc-test-generation/src/test/resources/entities/model/mapping/_.json create mode 100644 legend-sdlc-test-generation/src/test/resources/entities/model/mapping/public.json create mode 100644 legend-sdlc-test-generation/src/test/resources/generated/java/model/mapping/Test__.java create mode 100644 legend-sdlc-test-generation/src/test/resources/generated/java/model/mapping/Test_public.java create mode 100644 legend-sdlc-test-generation/src/test/resources/generated/java/org/finos/legend/sdlc/test/junit/junit4/model/mapping/Test__.java create mode 100644 legend-sdlc-test-generation/src/test/resources/generated/java/org/finos/legend/sdlc/test/junit/junit4/model/mapping/Test_public.java create mode 100644 legend-sdlc-test-generation/src/test/resources/generated/java/other/test/pkg/model/mapping/Test__.java create mode 100644 legend-sdlc-test-generation/src/test/resources/generated/java/other/test/pkg/model/mapping/Test_public.java diff --git a/legend-sdlc-test-generation/src/test/java/org/finos/legend/sdlc/test/junit/TestJUnitTestGeneratorCompilation.java b/legend-sdlc-test-generation/src/test/java/org/finos/legend/sdlc/test/junit/TestJUnitTestGeneratorCompilation.java index a2dde62ecc..9e02d97b7c 100644 --- a/legend-sdlc-test-generation/src/test/java/org/finos/legend/sdlc/test/junit/TestJUnitTestGeneratorCompilation.java +++ b/legend-sdlc-test-generation/src/test/java/org/finos/legend/sdlc/test/junit/TestJUnitTestGeneratorCompilation.java @@ -91,6 +91,13 @@ public void testSourceToTargetM2M() testCompilation("model.mapping.TestSourceToTargetM2M", "model::mapping::SourceToTargetM2M"); } + @Test + public void testJavaKeyWordCompilation() + { + testCompilation("model.mapping.Test_public", "model::mapping::public"); + testCompilation("model.mapping.Test__", "model::mapping::_"); + } + @Test public void testTestService() { diff --git a/legend-sdlc-test-generation/src/test/java/org/finos/legend/sdlc/test/junit/TestJUnitTestGeneratorSerialization.java b/legend-sdlc-test-generation/src/test/java/org/finos/legend/sdlc/test/junit/TestJUnitTestGeneratorSerialization.java index 4242bb6f84..7ae891b077 100644 --- a/legend-sdlc-test-generation/src/test/java/org/finos/legend/sdlc/test/junit/TestJUnitTestGeneratorSerialization.java +++ b/legend-sdlc-test-generation/src/test/java/org/finos/legend/sdlc/test/junit/TestJUnitTestGeneratorSerialization.java @@ -67,7 +67,10 @@ public void testWriteTestClassesWithoutRootPackage() throws IOException "generated/java/testTestSuites/TestTestService2.java", "generated/java/testTestSuites/TestServiceStoreMapping.java", "generated/java/testTestSuites/TestMyServiceIsVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVery_38d23576.java", "generated/java/testTestSuites/TestMyServiceIsââVeryââVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryââââVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryV_a0bb3f4b.java", - "generated/java/model/domain/TestFunctionTest__String_0_1_.java"); + "generated/java/model/domain/TestFunctionTest__String_0_1_.java", + "generated/java/model/mapping/Test__.java", + "generated/java/model/mapping/Test_public.java" + ); } @Test @@ -82,7 +85,10 @@ public void testWriteTestClasses() throws IOException "generated/java/org/finos/legend/sdlc/test/junit/junit4/testTestSuites/TestServiceStoreMapping.java", "generated/java/org/finos/legend/sdlc/test/junit/junit4/testTestSuites/TestMyServiceIsVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVery_38d23576.java", "generated/java/org/finos/legend/sdlc/test/junit/junit4/testTestSuites/TestMyServiceIsââVeryââVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryââââVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryV_a0bb3f4b.java", - "generated/java/org/finos/legend/sdlc/test/junit/junit4/model/domain/TestFunctionTest__String_0_1_.java"); + "generated/java/org/finos/legend/sdlc/test/junit/junit4/model/domain/TestFunctionTest__String_0_1_.java", + "generated/java/org/finos/legend/sdlc/test/junit/junit4/model/mapping/Test__.java", + "generated/java/org/finos/legend/sdlc/test/junit/junit4/model/mapping/Test_public.java" + ); } @Test @@ -97,7 +103,10 @@ public void testWriteTestClassesOtherPackage() throws IOException "generated/java/other/test/pkg/testTestSuites/TestServiceStoreMapping.java", "generated/java/other/test/pkg/testTestSuites/TestMyServiceIsVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVery_38d23576.java", "generated/java/other/test/pkg/testTestSuites/TestMyServiceIsââVeryââVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryââââVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryV_a0bb3f4b.java", - "generated/java/other/test/pkg/model/domain/TestFunctionTest__String_0_1_.java"); + "generated/java/other/test/pkg/model/domain/TestFunctionTest__String_0_1_.java", + "generated/java/other/test/pkg/model/mapping/Test__.java", + "generated/java/other/test/pkg/model/mapping/Test_public.java" + ); } private void testWriteTestClasses(String rootPackage, String... expectedResources) throws IOException diff --git a/legend-sdlc-test-generation/src/test/resources/entities/model/mapping/_.json b/legend-sdlc-test-generation/src/test/resources/entities/model/mapping/_.json new file mode 100644 index 0000000000..ceef0865d7 --- /dev/null +++ b/legend-sdlc-test-generation/src/test/resources/entities/model/mapping/_.json @@ -0,0 +1,10 @@ +{ + "classifierPath": "meta::pure::mapping::Mapping", + "content": { + "package": "model::mapping", + "_type": "mapping", + "name": "_", + "classMappings": [], + "tests": [] + } +} \ No newline at end of file diff --git a/legend-sdlc-test-generation/src/test/resources/entities/model/mapping/public.json b/legend-sdlc-test-generation/src/test/resources/entities/model/mapping/public.json new file mode 100644 index 0000000000..236a3a6afb --- /dev/null +++ b/legend-sdlc-test-generation/src/test/resources/entities/model/mapping/public.json @@ -0,0 +1,10 @@ +{ + "classifierPath": "meta::pure::mapping::Mapping", + "content": { + "package": "model::mapping", + "_type": "mapping", + "name": "public", + "classMappings": [], + "tests": [] + } +} \ No newline at end of file diff --git a/legend-sdlc-test-generation/src/test/resources/generated/java/model/mapping/Test__.java b/legend-sdlc-test-generation/src/test/resources/generated/java/model/mapping/Test__.java new file mode 100644 index 0000000000..fc595e05c8 --- /dev/null +++ b/legend-sdlc-test-generation/src/test/resources/generated/java/model/mapping/Test__.java @@ -0,0 +1,12 @@ +package model.mapping; + +import org.finos.legend.sdlc.test.junit.pure.v1.AbstractMappingTest; + +public class Test__ extends AbstractMappingTest +{ + @Override + protected String getEntityPath() + { + return "model::mapping::_"; + } +} diff --git a/legend-sdlc-test-generation/src/test/resources/generated/java/model/mapping/Test_public.java b/legend-sdlc-test-generation/src/test/resources/generated/java/model/mapping/Test_public.java new file mode 100644 index 0000000000..77e45be0cb --- /dev/null +++ b/legend-sdlc-test-generation/src/test/resources/generated/java/model/mapping/Test_public.java @@ -0,0 +1,12 @@ +package model.mapping; + +import org.finos.legend.sdlc.test.junit.pure.v1.AbstractMappingTest; + +public class Test_public extends AbstractMappingTest +{ + @Override + protected String getEntityPath() + { + return "model::mapping::public"; + } +} diff --git a/legend-sdlc-test-generation/src/test/resources/generated/java/org/finos/legend/sdlc/test/junit/junit4/model/mapping/Test__.java b/legend-sdlc-test-generation/src/test/resources/generated/java/org/finos/legend/sdlc/test/junit/junit4/model/mapping/Test__.java new file mode 100644 index 0000000000..be04090d71 --- /dev/null +++ b/legend-sdlc-test-generation/src/test/resources/generated/java/org/finos/legend/sdlc/test/junit/junit4/model/mapping/Test__.java @@ -0,0 +1,12 @@ +package org.finos.legend.sdlc.test.junit.junit4.model.mapping; + +import org.finos.legend.sdlc.test.junit.pure.v1.AbstractMappingTest; + +public class Test__ extends AbstractMappingTest +{ + @Override + protected String getEntityPath() + { + return "model::mapping::_"; + } +} diff --git a/legend-sdlc-test-generation/src/test/resources/generated/java/org/finos/legend/sdlc/test/junit/junit4/model/mapping/Test_public.java b/legend-sdlc-test-generation/src/test/resources/generated/java/org/finos/legend/sdlc/test/junit/junit4/model/mapping/Test_public.java new file mode 100644 index 0000000000..5997cc783b --- /dev/null +++ b/legend-sdlc-test-generation/src/test/resources/generated/java/org/finos/legend/sdlc/test/junit/junit4/model/mapping/Test_public.java @@ -0,0 +1,12 @@ +package org.finos.legend.sdlc.test.junit.junit4.model.mapping; + +import org.finos.legend.sdlc.test.junit.pure.v1.AbstractMappingTest; + +public class Test_public extends AbstractMappingTest +{ + @Override + protected String getEntityPath() + { + return "model::mapping::public"; + } +} diff --git a/legend-sdlc-test-generation/src/test/resources/generated/java/other/test/pkg/model/mapping/Test__.java b/legend-sdlc-test-generation/src/test/resources/generated/java/other/test/pkg/model/mapping/Test__.java new file mode 100644 index 0000000000..eef312fa0a --- /dev/null +++ b/legend-sdlc-test-generation/src/test/resources/generated/java/other/test/pkg/model/mapping/Test__.java @@ -0,0 +1,12 @@ +package other.test.pkg.model.mapping; + +import org.finos.legend.sdlc.test.junit.pure.v1.AbstractMappingTest; + +public class Test__ extends AbstractMappingTest +{ + @Override + protected String getEntityPath() + { + return "model::mapping::_"; + } +} diff --git a/legend-sdlc-test-generation/src/test/resources/generated/java/other/test/pkg/model/mapping/Test_public.java b/legend-sdlc-test-generation/src/test/resources/generated/java/other/test/pkg/model/mapping/Test_public.java new file mode 100644 index 0000000000..53cfe35c18 --- /dev/null +++ b/legend-sdlc-test-generation/src/test/resources/generated/java/other/test/pkg/model/mapping/Test_public.java @@ -0,0 +1,12 @@ +package other.test.pkg.model.mapping; + +import org.finos.legend.sdlc.test.junit.pure.v1.AbstractMappingTest; + +public class Test_public extends AbstractMappingTest +{ + @Override + protected String getEntityPath() + { + return "model::mapping::public"; + } +}