From bd666411cc02b56d67567d7fd2564207183470e6 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Mon, 19 Feb 2018 10:47:28 -0800 Subject: [PATCH] Frameworks: Fix JUnit4 test annotations Fix missing annotations in recoverablekeystore. Found by errorprone. Bug: 73513670 Test: atest PersistentKeyChainSnapshotTest Test: atest RecoverableKeyStoreDbTest Test: m javac-check RUN_ERROR_PRONE=true Change-Id: I976b29bf2c7f47d1a9c615b1f8102b593842724b --- .../storage/PersistentKeyChainSnapshotTest.java | 6 +++++- .../storage/RecoverableKeyStoreDbTest.java | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/PersistentKeyChainSnapshotTest.java b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/PersistentKeyChainSnapshotTest.java index aad5295abd75b..dcc6910e296a5 100644 --- a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/PersistentKeyChainSnapshotTest.java +++ b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/PersistentKeyChainSnapshotTest.java @@ -148,6 +148,7 @@ public class PersistentKeyChainSnapshotTest { () -> reader.readKeyEntry()); } + @Test public void testWriteProtectionParams() throws Exception { PersistentKeyChainSnapshot writer = new PersistentKeyChainSnapshot(); writer.initWriter(); @@ -174,6 +175,7 @@ public class PersistentKeyChainSnapshotTest { () -> reader.readProtectionParams()); } + @Test public void testKeyChainSnapshot() throws Exception { PersistentKeyChainSnapshot writer = new PersistentKeyChainSnapshot(); writer.initWriter(); @@ -233,6 +235,7 @@ public class PersistentKeyChainSnapshotTest { verifyDeserialize(snapshot); } + @Test public void testKeyChainSnapshot_withManyKeysAndProtectionParams() throws Exception { PersistentKeyChainSnapshot writer = new PersistentKeyChainSnapshot(); writer.initWriter(); @@ -316,7 +319,7 @@ public class PersistentKeyChainSnapshotTest { .isEqualTo(snapshot.getTrustedHardwarePublicKey()); } - + @Test public void testDeserialize_failsForNewerVersion() throws Exception { byte[] newVersion = new byte[]{(byte) 2, (byte) 0, (byte) 0, (byte) 0}; assertThrows( @@ -324,6 +327,7 @@ public class PersistentKeyChainSnapshotTest { () -> PersistentKeyChainSnapshot.deserialize(newVersion)); } + @Test public void testDeserialize_failsForEmptyData() throws Exception { byte[] empty = new byte[]{}; assertThrows( diff --git a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbTest.java b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbTest.java index 1c5bcd498f5c1..609faa49affaa 100644 --- a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbTest.java +++ b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbTest.java @@ -317,6 +317,7 @@ public class RecoverableKeyStoreDbTest { assertThat(statuses).hasSize(0); } + @Test public void testInvalidateKeysWithOldGenerationId_withSingleKey() { int userId = 12; int uid = 1009; @@ -372,6 +373,7 @@ public class RecoverableKeyStoreDbTest { pubkey); } + @Test public void setRecoveryServiceCertPath_replaceOldValue() throws Exception { int userId = 12; int uid = 10009; @@ -453,6 +455,7 @@ public class RecoverableKeyStoreDbTest { assertThat(agents).contains(uid2); } + @Test public void setRecoverySecretTypes_emptyDefaultValue() throws Exception { int userId = 12; int uid = 10009;