-
Notifications
You must be signed in to change notification settings - Fork 827
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test case to ensure we can modify the test account name and pas…
…sword
- Loading branch information
Filip Hanik
committed
May 15, 2014
1 parent
dadb0cf
commit 2798a09
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
common/src/test/java/org/cloudfoundry/identity/uaa/test/UaaTestAccountsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* ****************************************************************************** | ||
* Cloud Foundry | ||
* Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved. | ||
* | ||
* This product is licensed to you under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this product except in compliance with the License. | ||
* | ||
* This product includes a number of subcomponents with | ||
* separate copyright notices and license terms. Your use of these | ||
* subcomponents is subject to the terms and conditions of the | ||
* subcomponent's license, as noted in the LICENSE file. | ||
* ****************************************************************************** | ||
*/ | ||
|
||
package org.cloudfoundry.identity.uaa.test; | ||
|
||
import junit.framework.TestCase; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.springframework.security.oauth2.client.test.TestAccounts; | ||
|
||
public class UaaTestAccountsTest extends TestCase { | ||
|
||
private TestAccounts testAccounts; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
testAccounts = UaaTestAccounts.standard(null); | ||
} | ||
|
||
@Test | ||
public void testGetDefaultUsername() throws Exception { | ||
assertEquals(UaaTestAccounts.DEFAULT_USERNAME, testAccounts.getUserName()); | ||
} | ||
|
||
|
||
@Test | ||
public void testGetAlternateUsername() throws Exception { | ||
String property = "uaa.test.username"; | ||
try { | ||
String username = "marissa2"; | ||
System.setProperty(property, username); | ||
assertEquals(username, testAccounts.getUserName()); | ||
} finally { | ||
System.getProperties().remove(property); | ||
} | ||
} | ||
|
||
@Test | ||
public void testGetDefaultPassword() throws Exception { | ||
assertEquals(UaaTestAccounts.DEFAULT_WEAK_PASSWORD, testAccounts.getPassword()); | ||
} | ||
|
||
|
||
@Test | ||
public void testGetAlternatePassword() throws Exception { | ||
String property = "uaa.test.password"; | ||
try { | ||
String password = "koala2"; | ||
System.setProperty(property, password); | ||
assertEquals(password, testAccounts.getPassword()); | ||
} finally { | ||
System.getProperties().remove(property); | ||
} | ||
} | ||
|
||
} |