@Test
public void createWitness() throws InvalidAlgorithmParameterException,
        NoSuchAlgorithmException, NoSuchProviderException {

    byte[] message = new byte[10];
    Arrays.fill(message, (byte) 10);
    ECKeyPair keyPair = ECKeyPair.createEcKeyPair();
    Witness witness = Witness.createWitness(message, keyPair);
    // Test invocation script
    SignatureData expectedSig = Sign.signMessage(message, keyPair);
    String expected = "" +
            PUSHDATA1.toString() + "40" + // 64 bytes of signature data
            Numeric.toHexStringNoPrefix(expectedSig.getConcatenated()); // signature
    assertArrayEquals(
            Numeric.hexStringToByteArray(expected),
            witness.getInvocationScript().getScript());
    // Test verification script
    expected = "" +
            PUSHDATA1.toString() + "21" + // 33 bytes of public key
            Numeric.toHexStringNoPrefix(keyPair.getPublicKey().getEncoded(true)) + // pubKey
            PUSHNULL.toString() +
            SYSCALL.toString() + // syscall to...
            InteropServiceCode.NEO_CRYPTO_VERIFYWITHECDSASECP256R1.getHash(); // ...signature verification
    assertArrayEquals(
            Numeric.hexStringToByteArray(expected),
            witness.getVerificationScript().getScript());
}