-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add tests for submodel methods #360
Changes from 17 commits
00146aa
7d85df3
f647536
eec4505
9d72aa0
a3145d3
ea76b10
b55df5f
ecb50f2
cef93d3
97c9a0b
2864040
6f8be7a
d4ab075
22bc4b1
af6a98c
f20b967
e8477f8
8dbabf5
b6dedc0
888b53d
1afe2e3
8dada1d
df593c2
6b0241d
195c4c2
191eb3e
b9f069c
41e1079
5b4f3b4
e1610da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
{ | ||
"SubmodelElementList": [ | ||
{ | ||
"min": 200, | ||
"max": 300 | ||
}, | ||
"5000" | ||
], | ||
"EntityData": { | ||
"statements": [ | ||
{ | ||
"MaxRotationSpeed": "5000" | ||
}, | ||
{ | ||
"RotationSpeedRange": { | ||
"min": 200, | ||
"max": 300 | ||
} | ||
} | ||
], | ||
"entityType": "CoManagedEntity", | ||
"globalAssetId": "globalAssetID", | ||
"specificAssetIds": [ | ||
{ | ||
"specificAssetIdName": "specificValue" | ||
} | ||
] | ||
}, | ||
"RelationshipElement": { | ||
"first": { | ||
"type": "ModelReference", | ||
"keys": [ | ||
{ | ||
"type": "DataElement", | ||
"value": "DataElement" | ||
} | ||
] | ||
}, | ||
"second": { | ||
"type": "ExternalReference", | ||
"keys": [ | ||
{ | ||
"type": "BasicEventElement", | ||
"value": "BasicEventElement" | ||
} | ||
] | ||
} | ||
}, | ||
"ReferenceElement": { | ||
"type": "ModelReference", | ||
"keys": [ | ||
{ | ||
"type": "DataElement", | ||
"value": "DataElement" | ||
} | ||
] | ||
}, | ||
"BlobData": { | ||
"contentType": "application/xml", | ||
"value": "Test content of XML file" | ||
}, | ||
"SubmodelElementCollection": { | ||
"MaxRotationSpeed": "5000", | ||
"FileData": { | ||
"contentType": "application/json", | ||
"value": "testFile.json" | ||
} | ||
}, | ||
"MultiLanguage": [ | ||
{ | ||
"en": "Hello" | ||
}, | ||
{ | ||
"de": "Hallo" | ||
} | ||
], | ||
"AnnotatedRelationshipElement": { | ||
"first": { | ||
"type": "ModelReference", | ||
"keys": [ | ||
{ | ||
"type": "DataElement", | ||
"value": "DataElement" | ||
} | ||
] | ||
}, | ||
"second": { | ||
"type": "ExternalReference", | ||
"keys": [ | ||
{ | ||
"type": "BasicEventElement", | ||
"value": "BasicEventElement" | ||
} | ||
] | ||
}, | ||
"annotation": [ | ||
{ | ||
"MaxRotationSpeed": "5000" | ||
}, | ||
{ | ||
"RotationSpeedRange": { | ||
"min": 200, | ||
"max": 300 | ||
} | ||
} | ||
] | ||
}, | ||
"MaxRotationSpeed": "5000", | ||
"RotationSpeedRange": { | ||
"min": 200, | ||
"max": 300 | ||
}, | ||
"FileData": { | ||
"contentType": "application/json", | ||
"value": "testFile.json" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,4 +47,12 @@ public PropertyValue(String value) { | |
public String getValue() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need to override equals here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In getSubmodelByIdValueOnlyExistingSubmodel, I need to compare the objects of type SubmodelValueOnly which have a Map of items where the value is of type SubmodelElementValue. PropertyValue implements the interface SubmodelElementValue, hence, when i compare the SubmodelValueOnly objects, I'm actually comparing their map of items to check if they are equal. Given that PropertyValue isn't a primitive data type, I had to add the equals method so that the comparison can be made between the items. The test fails otherwise. |
||
if (this == obj) return true; | ||
if (obj == null || getClass() != obj.getClass()) return false; | ||
PropertyValue that = (PropertyValue) obj; | ||
return value.equals(that.value); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be getSubmodelByIdMetadata