ASiCWithXAdESSignatureParameters extends XAdESSignatureParameters { @Override public void setSignatureLevel(SignatureLevel signatureLevel) { if (signatureLevel == null || SignatureForm.XAdES != signatureLevel.getSignatureForm()) { throw new IllegalArgumentException("Only XAdES form is allowed !"); } super.setSignatureLevel(signatureLevel); }  ASiCParameters aSiC(); @Override void setSignatureLevel(SignatureLevel signatureLevel);  }
@Test public void test() { ASiCWithXAdESSignatureParameters params = new ASiCWithXAdESSignatureParameters(); Exception exception = assertThrows(IllegalArgumentException.class, () -> params.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B)); assertEquals("Only XAdES form is allowed !", exception.getMessage()); }