public void assertMerge(Map<String, Integer> replies, List<Integer> expectedErrors, List<String> allowedValues) {
        List<RoutingNode> selected = select(replies.size());

        for (RoutingNode node : selected) {
            String route = node.getRoute().toString();
            assertTrue(replies.containsKey(route));
            Reply ret = new SimpleReply(route);
            if (replies.get(route) != ErrorCode.NONE) {
                ret.addError(new com.yahoo.messagebus.Error(replies.get(route), route));
            }
            node.handleReply(ret);
        }

        Reply reply = handler.getReply(60);
        assertNotNull(reply);
        if (expectedErrors != null) {
            assertEquals(expectedErrors.size(), reply.getNumErrors());
            for (int i = 0; i < expectedErrors.size(); ++i) {
                assertTrue(expectedErrors.contains(reply.getError(i).getCode()));
            }
        } else if (reply.hasErrors()) {
            StringBuilder err = new StringBuilder("Got unexpected error(s):\n");
            for (int i = 0; i < reply.getNumErrors(); ++i) {
                err.append("\t").append(reply.getError(i).toString());
                if (i < reply.getNumErrors() - 1) {
                    err.append("\n");
                }
            }
            fail(err.toString());
        }
        if (allowedValues != null) {
            assertEquals(SimpleProtocol.REPLY, reply.getType());
            assertTrue(allowedValues.contains(((SimpleReply)reply).getValue()));
        } else {
            assertEquals(0, reply.getType());
        }
    }
Ensures that the current setup generates as many leaf nodes as there are members of the errors argument. Each
error is then given one of these errors, and the method then ensures that the single returned reply contains the
given list of expected errors. Finally, if the expected value argument is non-null, this method ensures that the
reply is a SimpleReply whose string value exists in the allowed list.

@param replies        The errors to set in the leaf node replies.
@param expectedErrors The list of expected errors in the merged reply.
@param allowedValues  The list of allowed values in the final reply.
documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/PolicyTestFrame.java