diff options
author | 2021-08-11 03:15:53 +0200 | |
---|---|---|
committer | 2021-08-11 03:15:53 +0200 | |
commit | 0d0a60137565ffcc21ed5d9add255f98167f4f11 (patch) | |
tree | 50fe3f1cb93e414b8e5b95dbe36e49fcaeb7c171 /model-data | |
parent | removed unused import (diff) | |
download | refinery-0d0a60137565ffcc21ed5d9add255f98167f4f11.tar.gz refinery-0d0a60137565ffcc21ed5d9add255f98167f4f11.tar.zst refinery-0d0a60137565ffcc21ed5d9add255f98167f4f11.zip |
test environment to evaluate the return value of put
Diffstat (limited to 'model-data')
-rw-r--r-- | model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/utils/MapTestEnvironment.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/utils/MapTestEnvironment.java b/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/utils/MapTestEnvironment.java index aaf9f50c..4c043350 100644 --- a/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/utils/MapTestEnvironment.java +++ b/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/utils/MapTestEnvironment.java | |||
@@ -103,11 +103,18 @@ public class MapTestEnvironment<K, V> { | |||
103 | } | 103 | } |
104 | 104 | ||
105 | public void put(K key, V value) { | 105 | public void put(K key, V value) { |
106 | sut.put(key, value); | 106 | V oldSutValue = sut.put(key, value); |
107 | V oldOracleValue; | ||
107 | if (value != sut.getDefaultValue()) { | 108 | if (value != sut.getDefaultValue()) { |
108 | oracle.put(key, value); | 109 | oldOracleValue = oracle.put(key, value); |
109 | } else { | 110 | } else { |
110 | oracle.remove(key); | 111 | oldOracleValue = oracle.remove(key); |
112 | } | ||
113 | if(oldSutValue == sut.getDefaultValue() && oldOracleValue != null) { | ||
114 | fail("After put, SUT old value was default, but oracle old walue was " + oldOracleValue); | ||
115 | } | ||
116 | if(oldSutValue != sut.getDefaultValue()) { | ||
117 | assertEquals(oldOracleValue, oldSutValue); | ||
111 | } | 118 | } |
112 | } | 119 | } |
113 | 120 | ||