1   /*
2    * Copyright 2001-2005 The Apache Software Foundation
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.apache.commons.mail;
17  
18  import javax.mail.PasswordAuthentication;
19  
20  import junit.framework.TestCase;
21  
22  /**
23   * JUnit test case for DefaultAuthenticator Class
24   *
25   * @since 1.0
26   * @author <a href="mailto:corey.scott@gmail.com">Corey Scott</a>
27   * @version $Id: DefaultAuthenticatorTest.java 240031 2005-08-25 10:01:21Z henning $
28   */
29  
30  public class DefaultAuthenticatorTest extends TestCase
31  {
32      /**
33       * @param name name
34       */
35      public DefaultAuthenticatorTest(String name)
36      {
37          super(name);
38      }
39  
40      /** */
41      public void testDefaultAuthenticatorConstructor()
42      {
43          //insert code testing basic functionality
44          String strUsername = "user.name";
45          String strPassword = "user.pwd";
46          DefaultAuthenticator authenicator =
47              new DefaultAuthenticator(strUsername, strPassword);
48  
49          assertTrue(
50              PasswordAuthentication.class.isInstance(
51                  authenicator.getPasswordAuthentication()));
52          assertEquals(
53              strUsername,
54              authenicator.getPasswordAuthentication().getUserName());
55          assertEquals(
56              strPassword,
57              authenicator.getPasswordAuthentication().getPassword());
58      }
59  
60  }