@@ -0,0 +1,3203 @@
+/***********************************************************************%0A * Copyright (c) 2006 The Apache Software Foundation.                  *%0A * All rights reserved.                                                *%0A * ------------------------------------------------------------------- *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22); you *%0A * may not use this file except in compliance with the License. You    *%0A * may obtain a copy of the License at:                                *%0A *                                                                     *%0A *     http://www.apache.org/licenses/LICENSE-2.0                      *%0A *                                                                     *%0A * Unless required by applicable law or agreed to in writing, software *%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,   *%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or     *%0A * implied.  See the License for the specific language governing       *%0A * permissions and limitations under the License.                      *%0A ***********************************************************************/%0A%0Apackage org.apache.james.transport.matchers;%0A%0Aimport java.io.UnsupportedEncodingException;%0Aimport java.util.Collection;%0A%0Aimport javax.mail.MessagingException;%0A%0Aimport org.apache.mailet.MailAddress;%0Aimport org.apache.mailet.Matcher;%0A%0Apublic class UserIsTest extends AbstractRecipientIsTest %7B%0A%0A    private final String USER = %22test%22;%0A%0A    public UserIsTest(String arg0) throws UnsupportedEncodingException %7B%0A        super(arg0);%0A    %7D%0A%0A    protected String getRecipientName() %7B%0A        return USER;%0A    %7D%0A%0A    // test if the recipients get returned as matched%0A    public void testHostIsMatchedAllRecipients() throws MessagingException %7B%0A        setRecipients(new MailAddress%5B%5D %7B new MailAddress(%0A                %22test@james.apache.org%22) %7D);%0A%0A        setupMockedMail();%0A        setupMatcher();%0A%0A        Collection matchedRecipients = matcher.match(mockedMail);%0A%0A        assertNotNull(matchedRecipients);%0A        assertEquals(matchedRecipients.size(), mockedMail.getRecipients()%0A                .size());%0A    %7D%0A%0A    // test if one recipients get returned as matched%0A    public void testHostIsMatchedOneRecipient() throws MessagingException %7B%0A        setRecipients(new MailAddress%5B%5D %7B%0A                new MailAddress(%22test@james.apache.org%22),%0A                new MailAddress(%22test2@james.apache.org%22) %7D);%0A%0A        setupAll();%0A%0A        Collection matchedRecipients = matcher.match(mockedMail);%0A%0A        assertNotNull(matchedRecipients);%0A        assertEquals(matchedRecipients.size(), 1);%0A    %7D%0A%0A    // test if no recipient get returned cause it not match%0A    public void testHostIsNotMatch() throws MessagingException %7B%0A        setRecipients(new MailAddress%5B%5D %7B%0A                new MailAddress(%22test2@james2.apache.org%22),%0A                new MailAddress(%22test2@james.apache.org%22) %7D);%0A%0A        setupMockedMail();%0A        setupMatcher();%0A%0A        Collection matchedRecipients = matcher.match(mockedMail);%0A%0A        assertEquals(matchedRecipients.size(), 0);%0A    %7D%0A%0A    protected Matcher createMatcher() %7B%0A        return new UserIs();%0A    %7D%0A%7D%0A

Add UserIs matcher junit test