rule.getPermissions(); control.andReturn(Arrays.asList(new Permission[] {}));
rule.getPermissionNames(); control.andReturn(Arrays.asList(new String[] {}));
    public void testGenerateNoPermissionRequiredRule() throws Exception {        Gateway[] gateways = new Gateway[GATEWAYS_LEN];        for (int i = 0; i < gateways.length; i++) {            gateways[i] = new Gateway();            gateways[i].setUniqueId();            gateways[i].setAddress("10.1.2." + i);        }        IMocksControl control = EasyMock.createControl();        IDialingRule rule = control.createMock(IDialingRule.class);        rule.getName();        control.andReturn("testrule").times(gateways.length);        rule.getDescription();        control.andReturn(null).times(gateways.length);        for (int i = 0; i < gateways.length; i++) {            rule.getTransformedPatterns(gateways[i]);            control.andReturn(new String[] {                "555", "666", "777"            });        }        rule.getPermissions();        control.andReturn(Arrays.asList(new Permission[] {}));        rule.getGateways();        control.andReturn(Arrays.asList(gateways));        control.replay();        MockAuthRules authRules = new MockAuthRules();        authRules.begin();        authRules.generate(rule);        authRules.end();        Document document = authRules.getDocument();        String domDoc = XmlUnitHelper.asString(document);        String hostMatchFormat = "/mappings/hostMatch[%d]/";        for (int i = 0; i < gateways.length; i++) {            String hostMatch = String.format(hostMatchFormat, i + 1);            assertXpathEvaluatesTo(gateways[i].getAddress(), hostMatch + "hostPattern", domDoc);            assertXpathEvaluatesTo("555", hostMatch + "userMatch/userPattern", domDoc);            assertXpathEvaluatesTo("666", hostMatch + "userMatch/userPattern[2]", domDoc);            assertXpathEvaluatesTo("777", hostMatch + "userMatch/userPattern[3]", domDoc);            assertXpathEvaluatesTo("", hostMatch + "/userMatch/permissionMatch", domDoc);        }        // check if generate no access has been called properly        assertEquals(GATEWAYS_LEN, authRules.uniqueGateways);        control.verify();    }