ASiCWithCAdESSignatureParameters extends CAdESSignatureParameters implements ASiCWithCAdESCommonParameters { @Override public void setSignatureLevel(SignatureLevel signatureLevel) { if (signatureLevel == null || SignatureForm.CAdES != signatureLevel.getSignatureForm()) { throw new IllegalArgumentException("Only CAdES form is allowed !"); } super.setSignatureLevel(signatureLevel); }  @Override ASiCParameters aSiC(); @Override void setSignatureLevel(SignatureLevel signatureLevel); @Override Date getZipCreationDate();  }
@Test public void testIllegal() { ASiCWithCAdESSignatureParameters params = new ASiCWithCAdESSignatureParameters(); Exception exception = assertThrows(IllegalArgumentException.class, () -> params.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B)); assertEquals("Only CAdES form is allowed !", exception.getMessage()); }