Skip to content
Snippets Groups Projects
Commit 98581211 authored by Zhibin Mai's avatar Zhibin Mai
Browse files

Add unit test to detect any change on the original object caused by method...

Add unit test to detect any change on the original object caused by method getChangedProperties(...)
parent ff196d20
No related branches found
No related tags found
1 merge request!846Refactor the augmenter to search and fetch indexed data from the ElasticSearch service directly
Pipeline #295183 failed
......@@ -349,6 +349,19 @@ public class PropertyUtilTest {
changedProperties.forEach(p -> Assert.assertTrue(expectedChangedWellLogProperties.contains(p)));
}
@Test
public void getChangedProperties_should_not_modify_originalObjects() {
Map<String, Object> dataMapLeft = getDataMap("well.json");
Map<String, Object> dataMapRight = getDataMap("well2.json");
String dataMapLeftText = dataMapLeft.toString();
String dataMapRightText = dataMapRight.toString();
PropertyUtil.getChangedProperties(dataMapLeft, dataMapRight);
Assert.assertEquals(dataMapLeftText, dataMapLeft.toString());
Assert.assertEquals(dataMapRightText, dataMapRightText.toString());
}
private Map<String, Object> getDataMap(String file) {
String jsonText = getJsonFromFile(file);
Type type = new TypeToken<Map<String, Object>>() {}.getType();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment