001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.commons.mail;
018    
019    import javax.mail.PasswordAuthentication;
020    
021    import junit.framework.TestCase;
022    
023    /**
024     * JUnit test case for DefaultAuthenticator Class
025     *
026     * @since 1.0
027     * @author <a href="mailto:corey.scott@gmail.com">Corey Scott</a>
028     * @version $Id: DefaultAuthenticatorTest.java 480401 2006-11-29 04:40:04Z bayard $
029     */
030    
031    public class DefaultAuthenticatorTest extends TestCase
032    {
033        /**
034         * @param name name
035         */
036        public DefaultAuthenticatorTest(String name)
037        {
038            super(name);
039        }
040    
041        /** */
042        public void testDefaultAuthenticatorConstructor()
043        {
044            //insert code testing basic functionality
045            String strUsername = "user.name";
046            String strPassword = "user.pwd";
047            DefaultAuthenticator authenicator =
048                new DefaultAuthenticator(strUsername, strPassword);
049    
050            assertTrue(
051                PasswordAuthentication.class.isInstance(
052                    authenicator.getPasswordAuthentication()));
053            assertEquals(
054                strUsername,
055                authenicator.getPasswordAuthentication().getUserName());
056            assertEquals(
057                strPassword,
058                authenicator.getPasswordAuthentication().getPassword());
059        }
060    
061    }