internal static void AssertKeyIsMap(ResourceIterator <IDictionary <string, object> > r, string keyKey, string valueKey, MapValue expected) { IList <IDictionary <string, object> > result = r.ToList(); assertEquals("Results for should have size " + expected.Size() + " but was " + result.Count, expected.Size(), result.Count); foreach (IDictionary <string, object> row in result) { TextValue key = ( TextValue )row[keyKey]; assertTrue(expected.ContainsKey(key.StringValue())); assertThat(row, hasKey(valueKey)); object objectValue = row[valueKey]; if (objectValue is ListValue) { ListValue value = ( ListValue )objectValue; ListValue expectedValues = ( ListValue )expected.Get(key.StringValue()); assertEquals("sizes", value.Size(), expectedValues.Size()); assertThat(Arrays.asList(value.AsArray()), containsInAnyOrder(expectedValues.AsArray())); } else { string value = (( TextValue )objectValue).stringValue(); string expectedValue = (( TextValue )expected.Get(key.StringValue())).stringValue(); assertThat(value, equalTo(expectedValue)); } } }