KerberosPrincipalParser extends NonParameterizedTypeParser<KerberosPrincipal> { @Override public KerberosPrincipal doParse(String raw) throws IllegalArgumentException { return new KerberosPrincipal(raw); }  @Override KerberosPrincipal doParse(String raw);  }
@Test public void testValidPrincipal() { String principal = "HTTP/example.com@EXAMPLE.COM"; assertEquals( new KerberosPrincipal(principal), new KerberosPrincipalParser().doParse(principal)); }
@Test(expected = IllegalArgumentException.class) public void testInvalidPrincipal() { new KerberosPrincipalParser().doParse("@HTTP/example.com"); }