2 * Copyright (c) 2014, 2015 Hewlett-Packard Development Company, L.P. and others. All rights reserved.
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
9 package org.opendaylight.aaa.tokenauthrealm.auth;
11 import static org.junit.Assert.assertEquals;
13 import java.util.HashSet;
14 import org.junit.Test;
15 import org.opendaylight.aaa.api.PasswordCredentials;
17 public class PasswordCredentialTest {
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());
26 PasswordCredentials pc2 = new PasswordCredentialBuilder().setUserName("bob")
27 .setPassword("secrete").build();
28 assertEquals(pc1, pc2);
30 PasswordCredentials pc3 = new PasswordCredentialBuilder().setUserName("bob")
31 .setPassword("secret").build();
32 HashSet<PasswordCredentials> pcs = new HashSet<>();
36 assertEquals(2, pcs.size());