  @Test
  public void signThrowsIfGeneratedSignatureIsNotCanonical() {

    // Arrange:
    final CryptoEngine engine = this.getCryptoEngine();
    final KeyPair keyPair = KeyPair.random(engine);
    final Ed25519DsaSigner dsaSigner =
        new Ed25519DsaSigner(keyPair) {
          @Override
          public boolean isCanonicalSignature(Signature signature) {
            return false;
          }
        };
    final byte[] input = RandomUtils.generateRandomBytes();

    // Act:
    Assertions.assertEquals(
        "Generated signature is not canonical",
        Assertions.assertThrows(CryptoException.class, () -> dsaSigner.sign(input)).getMessage());
  }