Skip to content
Snippets Groups Projects
Commit c2829de2 authored by Alinga Yeung's avatar Alinga Yeung
Browse files

Story 1657 rework. Added a test case for unsupported principal.

parent e6ec0673
No related branches found
No related tags found
No related merge requests found
......@@ -73,7 +73,9 @@ import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.security.Principal;
import javax.management.remote.JMXPrincipal;
import javax.security.auth.Subject;
import org.apache.log4j.Level;
......@@ -163,6 +165,25 @@ public class UserClientTest
}
}
@Test
public void testSubjectWithUnsupportedPrincipal() throws URISyntaxException, MalformedURLException
{
Principal principal = new JMXPrincipal("APIName");
try
{
// test subject augmentation given a subject with more than one principal
Subject subject = new Subject();
subject.getPrincipals().add(principal);
this.createUserClient().augmentSubject(subject);
Assert.fail("Expecting an IllegalArgumentException.");
}
catch(IllegalArgumentException e)
{
String expected = "Subject has unsupported principal " + principal.getName();
Assert.assertEquals(expected, e.getMessage());
}
}
protected UserClient createUserClient() throws URISyntaxException, MalformedURLException
{
RegistryClient regClient = new RegistryClient();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment