JsoStringMap<SimpleDto> childMap = JsoStringMap.create();
childMap.put("child1", SimpleDtoImpl.make().setName("c1-name").setValue("c1-value"));
childMap.put("child2", SimpleDtoImpl.make().setName("c2-name").setValue("c2-value"));
parent = ComplexDtoImpl.make().setId(OTHER).setMap(childMap);
parents.add(parent);
NestedDtoResponseImpl two = MockNestedDtoResponseImpl.make().setArray(parents);
// Different parents, different children.
parents = JsoArray.create();
childMap = JsoStringMap.create();
parent = ComplexDtoImpl.make().setId(NAME).setMap(childMap);
parents.add(parent);
childMap = JsoStringMap.create();
childMap.put("child3", SimpleDtoImpl.make().setName("c3-name").setValue("c3-value"));
childMap.put("child4", SimpleDtoImpl.make().setName("c4-name").setValue("c4-value"));
parent = ComplexDtoImpl.make().setId(OTHER).setMap(childMap);
parents.add(parent);
NestedDtoResponseImpl twoDifferent = MockNestedDtoResponseImpl.make().setArray(parents);
// One parent, no children.
parents = JsoArray.create();
childMap = JsoStringMap.create();
parent = ComplexDtoImpl.make().setId(OTHER).setMap(childMap);
parents.add(parent);
NestedDtoResponseImpl oneOfZero = MockNestedDtoResponseImpl.make().setArray(parents);
// One parent, two children.
parents = JsoArray.create();
childMap = JsoStringMap.create();
childMap.put("child1", SimpleDtoImpl.make().setName("c1-name").setValue("c1-value"));
childMap.put("child2", SimpleDtoImpl.make().setName("c2-name").setValue("c2-value"));
parent = ComplexDtoImpl.make().setId(NAME).setMap(childMap);
parents.add(parent);
NestedDtoResponseImpl oneOfSome = MockNestedDtoResponseImpl.make().setArray(parents);
assertCheckOkay(FrontendExpectation.checkMatch(two, two));
assertCheckFails("", FrontendExpectation.checkMatch(oneOfZero, oneOfSome));
assertCheckFails("field child1 is not an object, but undefined, "
+ "field child2 is not an object, but undefined",