### Question:
DoubleClickCrypto { protected byte[] initPlainData(int payloadSize, @Nullable byte[] initVector) { byte[] plainData = new byte[OVERHEAD_SIZE + payloadSize]; if (initVector == null) { ByteBuffer byteBuffer = ByteBuffer.wrap(plainData); byteBuffer.putLong(INITV_TIMESTAMP_OFFSET, millisToSecsAndMicros(System.currentTimeMillis())); byteBuffer.putLong(INITV_SERVERID_OFFSET, ThreadLocalRandom.current().nextLong()); } else { System.arraycopy(initVector, 0, plainData, INITV_BASE, min(INITV_SIZE, initVector.length)); } return plainData; } DoubleClickCrypto(Keys keys); byte[] decrypt(byte[] cipherData); byte[] encrypt(byte[] plainData); byte[] createInitVector(@Nullable Date timestamp, long serverId); byte[] createInitVector(long timestamp, long serverId); Date getTimestamp(byte[] data); long getServerId(byte[] data); @Override String toString(); static final String KEY_ALGORITHM; static final int INITV_BASE; static final int INITV_SIZE; static final int INITV_TIMESTAMP_OFFSET; static final int INITV_SERVERID_OFFSET; static final int PAYLOAD_BASE; static final int SIGNATURE_SIZE; static final int OVERHEAD_SIZE; }### Answer:
@Test public void testEncrypt_noNonce() { baseCrypto.initPlainData(8, null); }
@Test public void testEncrypt_nonceSize() { baseCrypto.initPlainData(8, new byte[0]); baseCrypto.initPlainData(8, new byte[DoubleClickCrypto.INITV_SIZE]); baseCrypto.initPlainData(8, new byte[DoubleClickCrypto.INITV_SIZE * 10]); }