Skip to content

Commit

Permalink
Assert on content of both milestoned association properties
Browse files Browse the repository at this point in the history
  • Loading branch information
jake-kim1 committed Nov 1, 2024
1 parent 8924b4e commit 80c6d10
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<? extends Property<?, ?>> firmProperty = type._originalMilestonedProperties().select(p -> p.getName().equals("firm"));
Class<?> typeEmployee = model.getClass("apps::Employee", SourceInformation.getUnknownSourceInformation());
RichIterable<? extends Property<?, ?>> firmProperty = typeEmployee._originalMilestonedProperties().select(p -> p.getName().equals("firm"));
Assert.assertEquals("Missing firm property in _originalMilestonedProperties", 1, firmProperty.size());
RichIterable<? extends Property<?, ?>> worksForProperty = type._originalMilestonedProperties().select(p -> p.getName().equals("worksFor"));
RichIterable<? extends Property<?, ?>> 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<? extends Property<?, ?>> 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<? extends Property<?, ?>> worksForPropertyFromAssoc = association._originalMilestonedProperties().select(p -> p.getName().equals("worksFor"));
RichIterable<? extends Property<? extends Object, ? extends Object>> originalMilestonedProperties = association._originalMilestonedProperties();
Assert.assertEquals("Expected 2 original milestoned properties, but found " + originalMilestonedProperties.size(), 2, originalMilestonedProperties.size());
RichIterable<? extends Property<?, ?>> worksForPropertyFromAssoc = originalMilestonedProperties.select(p -> p.getName().equals("worksFor"));
Assert.assertEquals("Missing worksFor property in _originalMilestonedProperties for association", 1, worksForPropertyFromAssoc.size());
RichIterable<? extends Property<?, ?>> employsPropertyFromAssoc = originalMilestonedProperties.select(p -> p.getName().equals("employs"));
Assert.assertEquals("Missing employs property in _originalMilestonedProperties for association", 1, employsPropertyFromAssoc.size());
}

@Test
Expand Down

0 comments on commit 80c6d10

Please sign in to comment.