rule.getPermissions(); control.andReturn(Arrays.asList(new Permission[] { Permission.VOICEMAIL
rule.getPermissionNames(); control.andReturn(Arrays.asList(new String[] { Permission.VOICEMAIL.getName()
    public void testGenerate() throws Exception {        UrlTransform voicemail = new UrlTransform();        voicemail                .setUrl("<sip:{digits}@{mediaserver};"                        + "play={voicemail}/sipx-cgi/voicemail/mediaserver.cgi?action=deposit&mailbox={digits}>;q=0.1");        UrlTransform voicemail2 = new UrlTransform();        voicemail2                .setUrl("<sip:{digits}@testserver;"                        + "play={voicemail}/sipx-cgi/voicemail/mediaserver.cgi?action=deposit&mailbox={digits}>;q=0.001");        IMocksControl control = EasyMock.createStrictControl();        IDialingRule rule = control.createMock(IDialingRule.class);        rule.isInternal();        control.andReturn(true);        rule.getHostPatterns();        control.andReturn(ArrayUtils.EMPTY_STRING_ARRAY);        rule.getName();        control.andReturn(null);        rule.getDescription();        control.andReturn("my rule description");        rule.getPatterns();        control.andReturn(new String[] {            "x."        });        rule.isInternal();        control.andReturn(true);        rule.getPermissions();        control.andReturn(Arrays.asList(new Permission[] {            Permission.VOICEMAIL        }));        rule.getTransforms();        control.andReturn(new Transform[] {            voicemail, voicemail2        });        control.replay();        MappingRules mappingRules = new MappingRules();        mappingRules.begin();        mappingRules.generate(rule);        mappingRules.end();        Document document = mappingRules.getDocument();        String domDoc = XmlUnitHelper.asString(document);        assertXpathEvaluatesTo("my rule description",                "/mappings/hostMatch/userMatch/description", domDoc);        assertXpathEvaluatesTo("x.", "/mappings/hostMatch/userMatch/userPattern", domDoc);        assertXpathEvaluatesTo("Voicemail",                "/mappings/hostMatch/userMatch/permissionMatch/permission", domDoc);        assertXpathEvaluatesTo(voicemail.getUrl(),                "/mappings/hostMatch/userMatch/permissionMatch/transform/url", domDoc);        assertXpathEvaluatesTo(voicemail2.getUrl(),                "/mappings/hostMatch/userMatch/permissionMatch/transform[2]/url", domDoc);        control.verify();    }