@Test
public void getSize() {

    List<Signer> signers = new ArrayList<>();
    signers.add(Signer.global(account1));
    signers.add(Signer.calledByEntry(account2));
    List<Witness> witnesses = new ArrayList<>();
    witnesses.add(new Witness(new byte[]{0x00}, new byte[]{0x00}));
    Transaction tx = new Transaction(neow,
            (byte) 0,
            0x01020304L,
            0x01020304L,
            signers,
            BigInteger.TEN.pow(8).longValue(),
            1L,
            new ArrayList<>(),
            new byte[]{(byte) OpCode.PUSH1.getCode()},
            witnesses);
    int expectedSize = 1 +  // Version
            4 +  // Nonce
            8 +  // System fee
            8 +  // Network fee
            4 + // Valid until block
            1 + // Signer list size
            1 + 20 + // Signer script hash, scope, allowed groups and allowed contracts
            1 + 20 + // Signer script hash and scope, allowed groups and allowed contracts
            1 + // Byte for attributes list size
            1 + 1 + // Byte for script length and the actual length
            1 + // Byte for witnesses list size
            1 + 1 + // Byte for invocation script length and the actual length.
            1 + 1; // Byte for verification script length and the actual length.
    assertThat(tx.getSize(), is(expectedSize));
}