-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add delete single string and all string functionality
- Loading branch information
Showing
5 changed files
with
137 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
securebox/src/androidTest/java/ptsiogas/gr/securebox/SecureBoxHelperTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package ptsiogas.gr.securebox | ||
|
||
import android.content.Context | ||
import android.support.test.InstrumentationRegistry | ||
import junit.framework.Assert.assertEquals | ||
import org.junit.Before | ||
import org.junit.Test | ||
|
||
class SecureBoxHelperTests { | ||
|
||
lateinit var instrumentationContext: Context | ||
|
||
@Before | ||
fun setup() { | ||
instrumentationContext = InstrumentationRegistry.getInstrumentation().context | ||
SecureBoxHelper.instance.init(instrumentationContext) | ||
} | ||
|
||
@Test | ||
fun encrypt_isCorrect() { | ||
assert(SecureBoxHelper.instance.encryptString("testVar", "This is a test", "testPassword")) | ||
} | ||
|
||
@Test | ||
fun decrypt_isCorrect() { | ||
val varName = "testVar" | ||
val message = "This is a test" | ||
val password = "testPassword" | ||
SecureBoxHelper.instance.encryptString(varName, message, password) | ||
assertEquals(message, SecureBoxHelper.instance.decryptString(varName, password)) | ||
} | ||
|
||
@Test | ||
fun delete_string_isCorrect() { | ||
val varName = "testVar" | ||
val message = "This is a test" | ||
val password = "testPassword" | ||
SecureBoxHelper.instance.encryptString(varName, message, password) | ||
assert(SecureBoxHelper.instance.deleteString(varName)) | ||
} | ||
|
||
@Test | ||
fun delete_all_strings_isCorrect() { | ||
val varName = "testVar" | ||
val varName2 = "testVar2" | ||
val message = "This is a test" | ||
val password = "testPassword" | ||
SecureBoxHelper.instance.encryptString(varName, message, password) | ||
SecureBoxHelper.instance.encryptString(varName2, message, password) | ||
assert(SecureBoxHelper.instance.deleteAllStrings()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
securebox/src/test/java/ptsiogas/gr/securebox/SecureBoxHelperTests.kt
This file was deleted.
Oops, something went wrong.