CSRBuilder { public void addIdentifier(Identifier id) { requireNonNull(id); if (Identifier.TYPE_DNS.equals(id.getType())) { addDomain(id.getDomain()); } else if (Identifier.TYPE_IP.equals(id.getType())) { addIP(id.getIP()); } else { throw new IllegalArgumentException("Unknown identifier type: " + id.getType()); } }  void addDomain(String domain); void addDomains(Collection<String> domains); void addDomains(String... domains); void addIP(InetAddress address); void addIPs(Collection<InetAddress> ips); void addIPs(InetAddress... ips); void addIdentifier(Identifier id); void addIdentifiers(Collection<Identifier> ids); void addIdentifiers(Identifier... ids); void setOrganization(String o); void setOrganizationalUnit(String ou); void setLocality(String l); void setState(String st); void setCountry(String c); void sign(KeyPair keypair); PKCS10CertificationRequest getCSR(); byte[] getEncoded(); void write(Writer w); void write(OutputStream out); @Override String toString();  }
@Test(expected = IllegalArgumentException.class) public void testUnknownType() { CSRBuilder builder = new CSRBuilder(); builder.addIdentifier(new Identifier("UnKnOwN", "123")); }