Bump versions to 0.14.2-SNAPSHOT
[aaa.git] / aaa-shiro / impl / src / test / java / org / opendaylight / aaa / shiro / tokenauthrealm / auth / PasswordCredentialTest.java
1 /*
2  * Copyright (c) 2014, 2015 Hewlett-Packard Development Company, L.P. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.aaa.shiro.tokenauthrealm.auth;
10
11 import static org.junit.Assert.assertEquals;
12
13 import java.util.HashSet;
14 import org.junit.Test;
15 import org.opendaylight.aaa.api.PasswordCredentials;
16
17 public class PasswordCredentialTest {
18
19     @Test
20     public void testBuilder() {
21         PasswordCredentials pc1 = new PasswordCredentialBuilder().setUserName("bob")
22                 .setPassword("secrete").build();
23         assertEquals("bob", pc1.username());
24         assertEquals("secrete", pc1.password());
25
26         PasswordCredentials pc2 = new PasswordCredentialBuilder().setUserName("bob")
27                 .setPassword("secrete").build();
28         assertEquals(pc1, pc2);
29
30         PasswordCredentials pc3 = new PasswordCredentialBuilder().setUserName("bob")
31                 .setPassword("secret").build();
32         HashSet<PasswordCredentials> pcs = new HashSet<>();
33         pcs.add(pc1);
34         pcs.add(pc2);
35         pcs.add(pc3);
36         assertEquals(2, pcs.size());
37     }
38
39 }