PR Feedback - Move out null test, add test for normal plaintext, and add test that null aad and empty aad equivalent
diff --git a/java/src/test/java/com/google/crypto/tink/subtle/AesSivTest.java b/java/src/test/java/com/google/crypto/tink/subtle/AesSivTest.java
index a53f7ee..9ecb39b 100644
--- a/java/src/test/java/com/google/crypto/tink/subtle/AesSivTest.java
+++ b/java/src/test/java/com/google/crypto/tink/subtle/AesSivTest.java
@@ -110,11 +110,6 @@
         byte[] rebuiltPlaintext = dead.decryptDeterministically(ciphertext, aad);
         assertEquals(AesUtil.BLOCK_SIZE, ciphertext.length);
         assertEquals(Hex.encode(plaintext), Hex.encode(rebuiltPlaintext));
-
-        byte[] nullAadCiphertext = dead.encryptDeterministically(plaintext, null);
-        byte[] nullAadDecryptedText = dead.decryptDeterministically(nullAadCiphertext, null);
-        assertEquals(AesUtil.BLOCK_SIZE, nullAadCiphertext.length);
-        assertEquals(Hex.encode(plaintext), Hex.encode(nullAadDecryptedText));
       }
     }
   }
@@ -149,6 +144,56 @@
   }
 
   @Test
+  public void testEncryptDecryptWithNullAssociatedData() throws GeneralSecurityException {
+    for (int keySize : keySizeInBytes) {
+      DeterministicAead dead = new AesSiv(Random.randBytes(keySize));
+      for (int triesPlaintext = 0; triesPlaintext < 100; triesPlaintext++) {
+        byte[] plaintext = Random.randBytes(Random.randInt(1024) + 1);
+        byte[] rebuiltPlaintext =
+            dead.decryptDeterministically(dead.encryptDeterministically(plaintext, null), null);
+        assertEquals(Hex.encode(plaintext), Hex.encode(rebuiltPlaintext));
+      }
+    }
+  }
+
+  @Test
+  public void testEncryptDecryptWithNullAndEmptyAssociatedDataEquivalent()
+      throws GeneralSecurityException {
+    for (int keySize : keySizeInBytes) {
+      DeterministicAead dead = new AesSiv(Random.randBytes(keySize));
+      for (int triesPlaintext = 0; triesPlaintext < 100; triesPlaintext++) {
+        byte[] plaintext = Random.randBytes(Random.randInt(1024) + 1);
+        byte[] emptyAad = new byte[0];
+        byte[] emptyAadCiphertext = dead.encryptDeterministically(plaintext, emptyAad);
+        byte[] emptyAadRebuiltPlaintext =
+                dead.decryptDeterministically(emptyAadCiphertext, emptyAad);
+
+        byte[] nullAadCipherText = dead.encryptDeterministically(plaintext, null);
+        byte[] nullAadRebuiltPlaintext =
+                dead.decryptDeterministically(nullAadCipherText, null);
+        
+        assertEquals(Hex.encode(plaintext), Hex.encode(emptyAadRebuiltPlaintext));
+        assertEquals(Hex.encode(plaintext), Hex.encode(nullAadRebuiltPlaintext));
+        assertEquals(Hex.encode(emptyAadCiphertext), Hex.encode(nullAadCipherText));
+      }
+    }
+  }
+
+  @Test
+  public void testEncryptDecryptWithEmptyPlaintextAndNullAssociatedData()
+      throws GeneralSecurityException {
+    for (int keySize : keySizeInBytes) {
+      DeterministicAead dead = new AesSiv(Random.randBytes(keySize));
+      for (int triesPlaintext = 0; triesPlaintext < 100; triesPlaintext++) {
+        byte[] plaintext = new byte[0];
+        byte[] rebuiltPlaintext =
+                dead.decryptDeterministically(dead.encryptDeterministically(plaintext, null), null);
+        assertEquals(Hex.encode(plaintext), Hex.encode(rebuiltPlaintext));
+      }
+    }
+  }
+
+  @Test
   public void testEncryptDecrypt() throws GeneralSecurityException {
     for (int keySize : keySizeInBytes) {
       DeterministicAead dead = new AesSiv(Random.randBytes(keySize));