@Test
public void serializeCustomGroupsScope() throws IOException {

    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
    BinaryWriter writer = new BinaryWriter(outStream);
    new Signer.Builder()
            .account(acctScriptHash)
            .allowedGroups(groupPubKey1, groupPubKey2)
            .build()
            .serialize(writer);
    byte[] actual = outStream.toByteArray();
    byte[] expected = Numeric.hexStringToByteArray(""
            + Numeric.reverseHexString(acctScriptHash.toString())
            + Numeric.toHexStringNoPrefix(WitnessScope.CUSTOM_GROUPS.byteValue())
            + "02" // array length 2
            + Numeric.toHexStringNoPrefix(groupPubKey1.toArray())
            + Numeric.toHexStringNoPrefix(groupPubKey2.toArray()));
    assertArrayEquals(expected, actual);
}