m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/pl/edu/mimuw
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2019-12-28 14:09:00 +0100
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2019-12-28 14:09:00 +0100
commit899e0768dad8418d1d1f2ee9294519d8ad8791a7 (patch)
treead62e7741f73b163bb2bdd886c731b251bdcd785 /src/test/java/pl/edu/mimuw
parent5f7e37d7b26832b3b512f9dda310cb9bc92c93fb (diff)
Test attribute removal
Diffstat (limited to 'src/test/java/pl/edu/mimuw')
-rw-r--r--src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/StanikTest.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/StanikTest.java b/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/StanikTest.java
index 31b701d..869dc1c 100644
--- a/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/StanikTest.java
+++ b/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/StanikTest.java
@@ -95,6 +95,24 @@ public class StanikTest {
assertEquals(new ValueString("baz"), actualAttributes.getOrNull("bar"));
}
+ @Test
+ public void updateWithRemovedAttributes() throws Exception {
+ AttributesMap attributes = new AttributesMap();
+ attributes.add("foo", new ValueInt(1337l));
+ attributes.add("bar", new ValueString("baz"));
+ UpdateAttributesMessage message = new UpdateAttributesMessage("test_msg", 0, "/", attributes);
+ stanik.handleTyped(message);
+
+ AttributesMap newAttributes = new AttributesMap();
+ newAttributes.add("foo", new ValueInt(1338l));
+ UpdateAttributesMessage newMessage = new UpdateAttributesMessage("test_msg2", 0, "/", newAttributes);
+ stanik.handleTyped(newMessage);
+
+ AttributesMap actualAttributes = stanik.getHierarchy().getAttributes();
+ assertEquals(1, countAttributes(actualAttributes));
+ assertEquals(new ValueInt(1338l), actualAttributes.getOrNull("foo"));
+ }
+
public int countAttributes(AttributesMap attributes) {
int count = 0;
for (Entry<Attribute, Value> attribute : attributes) {