1 package com.atlassian.seraph.util;
2
3 import junit.framework.TestCase;
4
5 public class TestSecurityUtils extends TestCase
6 {
7 public void testEncodeBasicAuthorizationCredentials() throws Exception
8 {
9 String basicAuthEncoded = SecurityUtils.encodeBasicAuthorizationCredentials("foo", "bar");
10
11 assertEquals("Basic Zm9vOmJhcg==", basicAuthEncoded);
12 }
13
14 public void testDecodeBasicAuthorizationCredentials() throws Exception
15 {
16
17 SecurityUtils.UserPassCredentials credentials = SecurityUtils.decodeBasicAuthorizationCredentials("Basic Zm9vOmJhcg==");
18 assertEquals("foo", credentials.getUsername());
19 assertEquals("bar", credentials.getPassword());
20 }
21 }