### Question:
XsuaaToken extends AbstractToken implements AccessToken { static String getUniquePrincipalName(String origin, String userName) { if (isNullOrEmpty(origin)) { LOGGER.warn("origin claim not set in JWT. Cannot create unique user name. Returning null."); return null; } if (isNullOrEmpty(userName)) { LOGGER.warn("user_name claim not set in JWT. Cannot create unique user name. Returning null."); return null; } if (origin.contains("/")) { LOGGER.warn( "Illegal '/' character detected in origin claim of JWT. Cannot create unique user name. Returning null."); return null; } return String.format(UNIQUE_USER_NAME_FORMAT, origin, userName); } XsuaaToken(@Nonnull DecodedJwt decodedJwt);  XsuaaToken(@Nonnull String accessToken); XsuaaToken withScopeConverter(@Nullable ScopeConverter converter); @Override Set<String> getScopes(); @Override Principal getPrincipal(); @Override Service getService(); @Override boolean hasScope(String scope); @Override boolean hasLocalScope(@Nonnull String scope); @Override GrantType getGrantType(); @Nullable String getSubdomain(); @Nullable String getSubaccountId(); @Override String getZoneId();  }### Answer:
@Test public void getUniquePrincipalName() { assertThat(XsuaaToken.getUniquePrincipalName("origin", "user")) .isEqualTo("user/origin/user"); }
@Test public void getUniquePrincipalName_cannotBeCreated_returnsNull() { assertThat(XsuaaToken.getUniquePrincipalName("origin/", "user")).isNull(); assertThat(XsuaaToken.getUniquePrincipalName("origin", "")).isNull(); assertThat(XsuaaToken.getUniquePrincipalName("", "user")).isNull(); assertThat(XsuaaToken.getUniquePrincipalName(null, "user")).isNull(); assertThat(XsuaaToken.getUniquePrincipalName("origin", null)).isNull(); }