### Question:
AgentPids { public static PID forPerson(String username) { Objects.requireNonNull(username, "Username must not be null"); return PIDs.get(PIDConstants.AGENTS_QUALIFIER, PERSON_AGENT_DOMAIN + "/" + ONYEN_DOMAIN + "/" + URIUtil.toSlug(username)); } private  AgentPids(); static PID forSoftware(SoftwareAgent agent); static PID forSoftware(String name); static PID forPerson(String username); static PID forPerson(AgentPrincipals princ); static final String SOFTWARE_AGENT_DOMAIN; static final String PERSON_AGENT_DOMAIN; static final String ONYEN_DOMAIN; }### Answer:
@Test public void pidForPersonUsername() throws Exception { assertEquals(BASE_URI + "agents/person/onyen/someuser", AgentPids.forPerson("someuser").getRepositoryPath()); assertEquals("agents/person/onyen/someuser", AgentPids.forPerson("someuser").getQualifiedId()); assertEquals("person/onyen/someuser", AgentPids.forPerson("someuser").getId()); }
@Test(expected = NullPointerException.class) public void pidForNullPersonUsername() throws Exception { AgentPids.forPerson((String) null); }
@Test public void pidForPersonAgentPrincipals() throws Exception { AgentPrincipals princs = new AgentPrincipals("someuser2", new AccessGroupSet("group")); assertEquals(BASE_URI + "agents/person/onyen/someuser2", AgentPids.forPerson(princs).getRepositoryPath()); }
@Test(expected = NullPointerException.class) public void pidForNullPersonAgentPrincipals() throws Exception { AgentPids.forPerson((AgentPrincipals) null); }