EnrollmentRequest { public void addAttrReq() throws InvalidArgumentException { if (attrreqs != null && !attrreqs.isEmpty()) { throw new InvalidArgumentException("Attributes have already been defined."); } attrreqs = new HashMap<>(); } EnrollmentRequest();  EnrollmentRequest(String profile, String label, KeyPair keypair); void setCsr(String csr); void setKeyPair(KeyPair keypair); String getProfile(); void setProfile(String profile); String getLabel(); void setLabel(String label); Collection<String> getHosts(); void addHost(String host); void addAttrReq(); AttrReq addAttrReq(String name);  }
@Test public void testEnrollReqToJsonAttrNullName() throws Exception { thrown.expect(InvalidArgumentException.class); thrown.expectMessage("name may not be null or empty."); EnrollmentRequest testEnrollReq = new EnrollmentRequest(); testEnrollReq.addAttrReq(null); }
@Test public void testEnrollReqToJsonAttrEmptyName() throws Exception { thrown.expect(InvalidArgumentException.class); thrown.expectMessage("name may not be null or empty."); EnrollmentRequest testEnrollReq = new EnrollmentRequest(); testEnrollReq.addAttrReq(""); }