As2DispositionNotificationOptions { public static As2DispositionNotificationOptions valueOf(String s) { if (s == null) { throw new IllegalArgumentException("Can not parse empty disposition-notification-options."); } List<Parameter> parameterList = new ArrayList<>(); log.debug("Inspecting " + s); Matcher matcher = PATTERN.matcher(s); while (matcher.find()) { if (matcher.groupCount() != 3) { throw new IllegalStateException("Internal error: Invalid group count in RegEx for parameter match in disposition-notification-options."); } String attributeName = matcher.group(1); String importanceName = matcher.group(2); String value = matcher.group(3); Attribute attribute = Attribute.fromString(attributeName); Importance importance = Importance.valueOf(importanceName.trim().toUpperCase()); Parameter parameter = Parameter.of(attribute, importance, value); parameterList.add(parameter); } if (parameterList.isEmpty()) { throw new IllegalArgumentException("Unable to create " + As2DispositionNotificationOptions.class.getSimpleName() + " from '" + s + "'"); } return new As2DispositionNotificationOptions(parameterList); } As2DispositionNotificationOptions(List<Parameter> parameters); static As2DispositionNotificationOptions getDefault(SMimeDigestMethod digestMethod); static As2DispositionNotificationOptions valueOf(String s); List<Parameter> getParameters(); Parameter getSignedReceiptMicalg(); String getPreferredSignedReceiptMicAlgorithmName(); Parameter getSignedReceiptProtocol(); @Override String toString();  }
@Test(expectedExceptions = IllegalArgumentException.class) public void createFromInvalidString() { As2DispositionNotificationOptions.valueOf("signed-receipt-protocol=reXXuired, pkcs7-signature"); }