From 80c6d1030fe8ce9e7baceab37a512d9a88cfbc78 Mon Sep 17 00:00:00 2001 From: "Kim, Jake" Date: Fri, 1 Nov 2024 13:32:18 -0400 Subject: [PATCH] Assert on content of both milestoned association properties --- .../TestDomainCompilationFromGrammar.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/test/java/org/finos/legend/engine/language/pure/compiler/test/fromGrammar/TestDomainCompilationFromGrammar.java b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/test/java/org/finos/legend/engine/language/pure/compiler/test/fromGrammar/TestDomainCompilationFromGrammar.java index b7484ee63d8..10d89844894 100644 --- a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/test/java/org/finos/legend/engine/language/pure/compiler/test/fromGrammar/TestDomainCompilationFromGrammar.java +++ b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/test/java/org/finos/legend/engine/language/pure/compiler/test/fromGrammar/TestDomainCompilationFromGrammar.java @@ -2429,15 +2429,23 @@ public void testClassesWithBusinessTemporalMilesoning() " employs: apps::Employee[*]; \n" + "} \n"); PureModel model = modelWithInput.getTwo(); - Class type = model.getClass("apps::Employee", SourceInformation.getUnknownSourceInformation()); - RichIterable> firmProperty = type._originalMilestonedProperties().select(p -> p.getName().equals("firm")); + Class typeEmployee = model.getClass("apps::Employee", SourceInformation.getUnknownSourceInformation()); + RichIterable> firmProperty = typeEmployee._originalMilestonedProperties().select(p -> p.getName().equals("firm")); Assert.assertEquals("Missing firm property in _originalMilestonedProperties", 1, firmProperty.size()); - RichIterable> worksForProperty = type._originalMilestonedProperties().select(p -> p.getName().equals("worksFor")); + RichIterable> worksForProperty = typeEmployee._originalMilestonedProperties().select(p -> p.getName().equals("worksFor")); Assert.assertEquals("Missing worksFor property in _originalMilestonedProperties", 1, worksForProperty.size()); + Class typeFirm = model.getClass("apps::Firm", SourceInformation.getUnknownSourceInformation()); + RichIterable> employsProperty = typeFirm._originalMilestonedProperties().select(p -> p.getName().equals("employs")); + Assert.assertEquals("Missing employs property in _originalMilestonedProperties", 1, employsProperty.size()); + Association association = model.getAssociation("apps::Employee_Firm", SourceInformation.getUnknownSourceInformation()); - RichIterable> worksForPropertyFromAssoc = association._originalMilestonedProperties().select(p -> p.getName().equals("worksFor")); + RichIterable> originalMilestonedProperties = association._originalMilestonedProperties(); + Assert.assertEquals("Expected 2 original milestoned properties, but found " + originalMilestonedProperties.size(), 2, originalMilestonedProperties.size()); + RichIterable> worksForPropertyFromAssoc = originalMilestonedProperties.select(p -> p.getName().equals("worksFor")); Assert.assertEquals("Missing worksFor property in _originalMilestonedProperties for association", 1, worksForPropertyFromAssoc.size()); + RichIterable> employsPropertyFromAssoc = originalMilestonedProperties.select(p -> p.getName().equals("employs")); + Assert.assertEquals("Missing employs property in _originalMilestonedProperties for association", 1, employsPropertyFromAssoc.size()); } @Test