Author: norman Date: Fri Jun 9 23:08:34 2006 New Revision: 413257 URL: http://svn.apache.org/viewvc?rev=413257&view=rev Log: Fix a bug in RemoteAddrInNetworkTest which cause junit to not detect the tests Add junit test for RemoteAddrNotInNetwork matcher
Added: james/server/trunk/src/test/org/apache/james/transport/matchers/RemoteAddrNotInNetworkTest.java Modified: james/server/trunk/src/test/org/apache/james/transport/matchers/RemoteAddrInNetworkTest.java Modified: james/server/trunk/src/test/org/apache/james/transport/matchers/RemoteAddrInNetworkTest.java URL: http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/transport/matchers/RemoteAddrInNetworkTest.java?rev=413257&r1=413256&r2=413257&view=diff ============================================================================== --- james/server/trunk/src/test/org/apache/james/transport/matchers/RemoteAddrInNetworkTest.java (original) +++ james/server/trunk/src/test/org/apache/james/transport/matchers/RemoteAddrInNetworkTest.java Fri Jun 9 23:08:34 2006 @@ -32,7 +32,7 @@ } // test if the recipients get returned as matched - public void RemoteAddrInNetworkMatched() throws MessagingException { + public void testRemoteAddrInNetworkMatched() throws MessagingException { setRemoteAddr("192.168.200.1"); setupAll(); @@ -45,7 +45,7 @@ } // test if no recipient get returned cause it not match - public void RemoteAddrInNetworkNotMatch() throws MessagingException { + public void testRemoteAddrInNetworkNotMatch() throws MessagingException { setRemoteAddr("192.168.1.1"); setupAll(); Added: james/server/trunk/src/test/org/apache/james/transport/matchers/RemoteAddrNotInNetworkTest.java URL: http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/transport/matchers/RemoteAddrNotInNetworkTest.java?rev=413257&view=auto ============================================================================== --- james/server/trunk/src/test/org/apache/james/transport/matchers/RemoteAddrNotInNetworkTest.java (added) +++ james/server/trunk/src/test/org/apache/james/transport/matchers/RemoteAddrNotInNetworkTest.java Fri Jun 9 23:08:34 2006 @@ -0,0 +1,69 @@ +/*********************************************************************** + * Copyright (c) 2006 The Apache Software Foundation. * + * All rights reserved. * + * ------------------------------------------------------------------- * + * Licensed under the Apache License, Version 2.0 (the "License"); you * + * may not use this file except in compliance with the License. You * + * may obtain a copy of the License at: * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * + * implied. See the License for the specific language governing * + * permissions and limitations under the License. * + ***********************************************************************/ + +package org.apache.james.transport.matchers; + +import java.io.UnsupportedEncodingException; +import java.util.Collection; + +import javax.mail.MessagingException; + +public class RemoteAddrNotInNetworkTest extends AbstractRemoteAddrInNetworkTest { + + private final String ALLOWED_NETWORK = "192.168.200.0/24"; + + public RemoteAddrNotInNetworkTest(String arg0) + throws UnsupportedEncodingException { + super(arg0); + } + + // test if the recipients get returned as matched + public void testRemoteAddrNotInNetworkMatched() throws MessagingException { + setRemoteAddr("192.168.0.1"); + + setupAll(); + + Collection matchedRecipients = matcher.match(mockedMail); + + assertNotNull(matchedRecipients); + assertEquals(matchedRecipients.size(), mockedMail.getRecipients() + .size()); + } + + // test if no recipient get returned cause it not match + public void testRemoteAddrNotInNetworkNotMatch() throws MessagingException { + setRemoteAddr("192.168.200.1"); + + setupAll(); + + Collection matchedRecipients = matcher.match(mockedMail); + + assertNull(matchedRecipients); + } + + protected AbstractNetworkMatcher createMatcher() { + return new RemoteAddrNotInNetwork(); + } + + protected String getConfigOption() { + return "AllowedNetworkIs="; + } + + protected String getAllowedNetworks() { + return ALLOWED_NETWORK; + } +} --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]