From 8c8689b0f8a9adaed86fc6458780dbd7d06ad2f0 Mon Sep 17 00:00:00 2001 From: Brian Estrada Date: Wed, 9 May 2018 13:47:54 +0200 Subject: [PATCH] Made preference class public + version bump --- locksmith/maven-push.gradle | 2 +- .../locksmith/core/ExampleInstrumentedTest.kt | 24 ++++++++++++++ .../preferences/EncryptedPreferences.java | 2 +- .../locksmith/core/util/HashingUtilsTest.java | 31 ------------------- 4 files changed, 26 insertions(+), 33 deletions(-) create mode 100644 locksmith/src/androidTest/java/dk/nodes/locksmith/core/ExampleInstrumentedTest.kt delete mode 100644 locksmith/src/test/java/dk/nodes/locksmith/core/util/HashingUtilsTest.java diff --git a/locksmith/maven-push.gradle b/locksmith/maven-push.gradle index 9f23c0a..2f6748b 100644 --- a/locksmith/maven-push.gradle +++ b/locksmith/maven-push.gradle @@ -12,7 +12,7 @@ allprojects { ext."signing.password" = System.getenv('password') } // Artifact settings def _group = 'dk.nodes.locksmith' -def _version = '1.1.2' +def _version = '1.2.1' def _archivesBaseName = 'core' def _name = 'Locksmith Encryption Library' diff --git a/locksmith/src/androidTest/java/dk/nodes/locksmith/core/ExampleInstrumentedTest.kt b/locksmith/src/androidTest/java/dk/nodes/locksmith/core/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..4b495f4 --- /dev/null +++ b/locksmith/src/androidTest/java/dk/nodes/locksmith/core/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package dk.nodes.locksmith.core.example + +import android.support.test.InstrumentationRegistry +import android.support.test.runner.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getTargetContext() + assertEquals("dk.nodes.locksmith.core", appContext.packageName) + } +} diff --git a/locksmith/src/main/java/dk/nodes/locksmith/core/preferences/EncryptedPreferences.java b/locksmith/src/main/java/dk/nodes/locksmith/core/preferences/EncryptedPreferences.java index a19c4af..e1c89f6 100644 --- a/locksmith/src/main/java/dk/nodes/locksmith/core/preferences/EncryptedPreferences.java +++ b/locksmith/src/main/java/dk/nodes/locksmith/core/preferences/EncryptedPreferences.java @@ -12,7 +12,7 @@ public class EncryptedPreferences { private SharedPreferences sharedPreferences; - EncryptedPreferences(Context context, String name, int mode) { + public EncryptedPreferences(Context context, String name, int mode) { this.sharedPreferences = context.getSharedPreferences(name, mode); } diff --git a/locksmith/src/test/java/dk/nodes/locksmith/core/util/HashingUtilsTest.java b/locksmith/src/test/java/dk/nodes/locksmith/core/util/HashingUtilsTest.java deleted file mode 100644 index 8d5424f..0000000 --- a/locksmith/src/test/java/dk/nodes/locksmith/core/util/HashingUtilsTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package dk.nodes.locksmith.core.util; - -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; - -public class HashingUtilsTest { - private String testString = "This is a test hash"; - private String sha1TestResult = "bd76dc781a1576047dd5f82e5206a012714fe022"; - private String sha256TestResult = "874560b0db4360448acaa8edabe16524c822a000a08358100607215396b76057"; - private String sha512TestResult = "5a021be64aad901d553eda5d175fae6ee2c158a7b3dfce5b3b0677dfffef42a793177936b5960f1bdc70cb6ef6cf02d4c8ea7587293ab8c4625c39e9ac9d7af4"; - - @Test - public void sha1_shouldPass() throws Exception { - String result = HashingUtils.sha1(testString); - assertEquals(result, sha1TestResult); - } - - @Test - public void sha256_shouldPass() throws Exception { - String result = HashingUtils.sha256(testString); - assertEquals(result, sha256TestResult); - } - - @Test - public void sha512_shouldPass() throws Exception { - String result = HashingUtils.sha512(testString); - assertEquals(result, sha512TestResult); - } - -} \ No newline at end of file