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

Story 1657 rework. Updated test code to catch unexpected exceptions.

parent c2829de2
No related branches found
No related tags found
No related merge requests found
......@@ -138,16 +138,23 @@ public class UserClientTest
}
@Test
public void testSubjectWithNoPrincipal() throws URISyntaxException, MalformedURLException
public void testSubjectWithNoPrincipal()
{
// test subject augmentation given a subject with no principal
Subject subject = new Subject();
this.createUserClient().augmentSubject(subject);
Assert.assertEquals("Should have no principal.", 0, subject.getPrincipals().size());
try
{
// test subject augmentation given a subject with no principal
Subject subject = new Subject();
this.createUserClient().augmentSubject(subject);
Assert.assertEquals("Should have no principal.", 0, subject.getPrincipals().size());
}
catch(Throwable t)
{
Assert.fail("Unexpected exception: " + t.getMessage());
}
}
@Test
public void testSubjectWithMultiplePrincipal() throws URISyntaxException, MalformedURLException
public void testSubjectWithMultiplePrincipal()
{
try
{
......@@ -163,10 +170,14 @@ public class UserClientTest
String expected = "Subject has more than one principal.";
Assert.assertEquals(expected, e.getMessage());
}
catch(Throwable t)
{
Assert.fail("Unexpected exception: " + t.getMessage());
}
}
@Test
public void testSubjectWithUnsupportedPrincipal() throws URISyntaxException, MalformedURLException
public void testSubjectWithUnsupportedPrincipal()
{
Principal principal = new JMXPrincipal("APIName");
try
......@@ -182,6 +193,10 @@ public class UserClientTest
String expected = "Subject has unsupported principal " + principal.getName();
Assert.assertEquals(expected, e.getMessage());
}
catch(Throwable t)
{
Assert.fail("Unexpected exception: " + t.getMessage());
}
}
protected UserClient createUserClient() throws URISyntaxException, MalformedURLException
......
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