diff options
author | Art O Cathain <art.home@gmail.com> | 2014-06-15 16:08:41 +0100 |
---|---|---|
committer | Art O Cathain <art.home@gmail.com> | 2014-06-16 18:58:41 +0100 |
commit | d06ba72edc3136ef2ff8a758e8d53fa13347c778 (patch) | |
tree | 85f122b507e66efca0843f50e81431815fa2c4a1 /OpenKeychain/src/test/java/tests | |
parent | 21e9d0b7b4b0375c43287d4acd66ee01f2f1d5a0 (diff) | |
download | open-keychain-d06ba72edc3136ef2ff8a758e8d53fa13347c778.tar.gz open-keychain-d06ba72edc3136ef2ff8a758e8d53fa13347c778.tar.bz2 open-keychain-d06ba72edc3136ef2ff8a758e8d53fa13347c778.zip |
Start on Robolectric integration test
Diffstat (limited to 'OpenKeychain/src/test/java/tests')
-rw-r--r-- | OpenKeychain/src/test/java/tests/RoboTest.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/OpenKeychain/src/test/java/tests/RoboTest.java b/OpenKeychain/src/test/java/tests/RoboTest.java new file mode 100644 index 000000000..1a4f6b4aa --- /dev/null +++ b/OpenKeychain/src/test/java/tests/RoboTest.java @@ -0,0 +1,37 @@ +package tests; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.*; +import org.openintents.openpgp.OpenPgpSignatureResult; +import org.sufficientlysecure.keychain.testsupport.PgpVerifyTestingHelper; + +@RunWith(RobolectricTestRunner.class) +@org.robolectric.annotation.Config(emulateSdk = 18) // Robolectric doesn't yet support 19 +public class RoboTest { + + @Test + public void testVerifySuccess() throws Exception { + + String testFileName = "/sample.txt"; + int expectedSignatureResult = OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED; + + int status = new PgpVerifyTestingHelper(Robolectric.application).doTestFile(testFileName); + + Assert.assertEquals(expectedSignatureResult, status); + } + + + @Test + public void testVerifyFailure() throws Exception { + + String testFileName = "/sample-altered.txt"; + int expectedSignatureResult = OpenPgpSignatureResult.SIGNATURE_ERROR; + + int status = new PgpVerifyTestingHelper(Robolectric.application).doTestFile(testFileName); + + Assert.assertEquals(expectedSignatureResult, status); + } + +} |