spec/lutaml/parsers/xmi_spec.rb in lutaml-xmi-0.1.1 vs spec/lutaml/parsers/xmi_spec.rb in lutaml-xmi-0.1.2
- old
+ new
@@ -14,10 +14,11 @@
Permission
Recommendation
Requirement
RequirementSubpart
RequirementType
+ TemporalGeometricPrimitive
]
end
let(:expected_class_xmi_ids) do
%w[
EAID_D832D6D8_0518_43f7_9166_7A4E3E8605AA
@@ -26,10 +27,11 @@
EAID_82354CDC_EACB_402f_8C2B_FD627B7416E7
EAID_AD7320C2_FEE6_4352_8D56_F2C8562B6153
EAID_2AC20C81_1E83_400d_B098_BAB784395E06
EAID_035D8176_5E9E_42c8_B447_64411AE96F57
EAID_C1155D80_E68B_46d5_ADE5_F5639486163D
+ EAID_37BF1557_0370_435d_94BB_8FCC4574561B
]
end
let(:expected_enum_names) { ["ObligationType"] }
let(:expected_enum_xmi_ids) { ["EAID_E497ABDA_05EF_416a_A461_03535864970D"] }
let(:expected_attributes_names) do
@@ -82,10 +84,19 @@
EAJava_String_0..1__
EAJava_boolean_0..1__
EAJava_RequirementSubpart_0..___
]
end
+ let(:expected_association_names) do
+ %w[
+ TemporalGeometricPrimitive
+ TemporalGeometry
+ TemporalTopologicalPrimitive
+ Interval
+ Instant
+ ]
+ end
let(:first_package) { parse.packages.first }
let(:first_nested_package) { parse.packages.first.packages.first }
it "parses xml file into Lutaml::Uml::Node::Document object" do
expect(parse).to(be_instance_of(::Lutaml::Uml::Document))
@@ -114,11 +125,20 @@
expect(klass.attributes.map(&:name)).to(eq(expected_attributes_names))
expect(klass.attributes.map(&:type)).to(eq(expected_attributes_types))
end
it "correctly parses associations for class" do
- klass = first_nested_package.classes.find { |entity| entity.name == 'BibliographicItem' }
- expect(klass.associations.map(&:member_end)).to(eq(['RequirementType']))
+ klass = first_nested_package.classes.find { |entity| entity.name == 'TemporalGeometricPrimitive' }
+ expect(klass.associations.map(&:member_end).compact).to(eq(expected_association_names))
+
+ inheritance = klass.associations.find { |entity| entity.member_end == 'TemporalGeometry' }
+ expect(inheritance.member_end_type).to eq('inheritance')
+ expect(inheritance.member_end_cardinality).to eq({"min"=>"C", "max"=>"*"})
+
+ aggregation = klass.associations.find { |entity| entity.member_end == 'TemporalTopologicalPrimitive' }
+ expect(aggregation.member_end_attribute_name).to eq('topology')
+ expect(aggregation.member_end_type).to eq('aggregation')
+ expect(aggregation.member_end_cardinality).to eq({"min"=>"C", "max"=>"*"})
end
end
end
end