### Question:
JwtPrincipal implements Principal { @Override public String getName() { return jwt.get("sub").asString(); } JwtPrincipal(final JsonValue jwt); @Override String getName(); String getClaim(String key); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void shouldUseSubAsPrincipalName() { final String name = "test subject"; final JwtPrincipal principal = new JwtPrincipal(json(object(field("sub", name)))); final String result = principal.getName(); assertThat(result).isEqualTo(name); }