diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2014-07-09 15:53:18 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2014-07-09 16:03:30 +0200 |
commit | 718acbf954b1318c6a90ba0f9c79e63f398fb498 (patch) | |
tree | c5c99374ed368d07348d17212527c4e86297f061 /OpenKeychain/src/test/java/tests/UncachedKeyringTest.java | |
parent | 9320d2d8a204496ace8f973a59594ccd698a2170 (diff) | |
download | open-keychain-718acbf954b1318c6a90ba0f9c79e63f398fb498.tar.gz open-keychain-718acbf954b1318c6a90ba0f9c79e63f398fb498.tar.bz2 open-keychain-718acbf954b1318c6a90ba0f9c79e63f398fb498.zip |
put unit tests into external module (CAVEAT)
this requires a more up to date version of gradle-android-test-plugin
than is currently in the repositories. it must be added to the local
maven repo using ./install-custom-gradle-test-plugin.sh before
compiling.
Diffstat (limited to 'OpenKeychain/src/test/java/tests/UncachedKeyringTest.java')
-rw-r--r-- | OpenKeychain/src/test/java/tests/UncachedKeyringTest.java | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/OpenKeychain/src/test/java/tests/UncachedKeyringTest.java b/OpenKeychain/src/test/java/tests/UncachedKeyringTest.java deleted file mode 100644 index 86089340c..000000000 --- a/OpenKeychain/src/test/java/tests/UncachedKeyringTest.java +++ /dev/null @@ -1,51 +0,0 @@ -package tests; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.robolectric.*; -import org.sufficientlysecure.keychain.pgp.UncachedKeyRing; -import org.sufficientlysecure.keychain.service.OperationResultParcel; -import org.sufficientlysecure.keychain.testsupport.*; -import org.sufficientlysecure.keychain.testsupport.KeyringBuilder; -import org.sufficientlysecure.keychain.testsupport.KeyringTestingHelper; -import org.sufficientlysecure.keychain.testsupport.TestDataUtil; - -import java.util.HashSet; - -@RunWith(RobolectricTestRunner.class) -@org.robolectric.annotation.Config(emulateSdk = 18) // Robolectric doesn't yet support 19 -public class UncachedKeyringTest { - - @Test - public void testVerifySuccess() throws Exception { - UncachedKeyRing expectedKeyRing = KeyringBuilder.ring2(); - UncachedKeyRing inputKeyRing = KeyringBuilder.ring1(); - // new UncachedKeyringTestingHelper().doTestCanonicalize(inputKeyRing, expectedKeyRing); - - OperationResultParcel.OperationLog log = new OperationResultParcel.OperationLog(); - UncachedKeyRing canonicalizedRing = inputKeyRing.canonicalize(log, 0); - - if (canonicalizedRing == null) { - throw new AssertionError("Canonicalization failed; messages: [" + log.toString() + "]"); - } - - HashSet onlyA = new HashSet<KeyringTestingHelper.Packet>(); - HashSet onlyB = new HashSet<KeyringTestingHelper.Packet>(); - Assert.assertTrue(KeyringTestingHelper.diffKeyrings( - canonicalizedRing.getEncoded(), expectedKeyRing.getEncoded(), onlyA, onlyB)); - - } - - /** - * Just testing my own test code. Should really be using a library for this. - */ - @Test - public void testConcat() throws Exception { - byte[] actual = TestDataUtil.concatAll(new byte[]{1}, new byte[]{2,-2}, new byte[]{5},new byte[]{3}); - byte[] expected = new byte[]{1,2,-2,5,3}; - Assert.assertEquals(java.util.Arrays.toString(expected), java.util.Arrays.toString(actual)); - } - - -} |