aboutsummaryrefslogtreecommitdiff
path: root/java/android/OlmLibSdk/olm-sdk/src/androidTest
diff options
context:
space:
mode:
authorylecollen <ylecollen@amdocs.com>2017-01-10 14:45:20 +0100
committerylecollen <ylecollen@amdocs.com>2017-01-10 14:45:20 +0100
commit03ae28e0873486649421b9428c4407851a89241c (patch)
tree5327d1e0d17e9e5b2b69832915b55c6b16685b83 /java/android/OlmLibSdk/olm-sdk/src/androidTest
parenteeb210f733924d9c48e82c66e53f0630f05d894e (diff)
Update after a new review
Diffstat (limited to 'java/android/OlmLibSdk/olm-sdk/src/androidTest')
-rw-r--r--java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmAccountTest.java7
-rw-r--r--java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmSessionTest.java20
-rw-r--r--java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmUtilityTest.java14
3 files changed, 9 insertions, 32 deletions
diff --git a/java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmAccountTest.java b/java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmAccountTest.java
index d474f12..ffbbca1 100644
--- a/java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmAccountTest.java
+++ b/java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmAccountTest.java
@@ -389,17 +389,12 @@ public class OlmAccountTest {
assertTrue(e.getMessage(),false);
}
- boolean sessionRetCode = true;
-
try {
- sessionRetCode = olmAccount.removeOneTimeKeys(null);
+ olmAccount.removeOneTimeKeys(null);
} catch (Exception e) {
assertTrue(e.getMessage(), false);
}
- // test against no matching keys
- assertFalse(sessionRetCode);
-
olmAccount.releaseAccount();
}
diff --git a/java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmSessionTest.java b/java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmSessionTest.java
index bb24f7a..e08b151 100644
--- a/java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmSessionTest.java
+++ b/java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmSessionTest.java
@@ -174,13 +174,11 @@ public class OlmSessionTest {
assertTrue(clearMsg.equals(decryptedMsg));
// clean objects..
- boolean res = false;
try {
- res = bobAccount.removeOneTimeKeys(bobSession);
+ bobAccount.removeOneTimeKeys(bobSession);
} catch (Exception e) {
assertTrue(e.getMessage(), false);
}
- assertTrue(res);
// release accounts
bobAccount.releaseAccount();
@@ -402,13 +400,11 @@ public class OlmSessionTest {
assertTrue(clearMsg1.equals(decryptedMsg1));
// clean objects..
- boolean res = false;
try {
- res = bobAccount.removeOneTimeKeys(bobSession);
+ bobAccount.removeOneTimeKeys(bobSession);
} catch (Exception e) {
assertTrue(e.getMessage(), false);
}
- assertTrue(res);
bobAccount.releaseAccount();
aliceAccount.releaseAccount();
@@ -585,13 +581,11 @@ public class OlmSessionTest {
//assertTrue(false==bobSession.matchesInboundSessionFrom(bobIdentityKey, encryptedAliceToBobMsg1.mCipherText));
// release objects
- boolean res = false;
try {
- res = bobAccount.removeOneTimeKeys(bobSession);
+ bobAccount.removeOneTimeKeys(bobSession);
} catch (Exception e) {
assertTrue(e.getMessage(), false);
}
- assertTrue(res);
aliceAccount.releaseAccount();
bobAccount.releaseAccount();
@@ -782,13 +776,11 @@ public class OlmSessionTest {
assertTrue(clearMsg3.equals(decryptedMsg3));
// clean objects..
- boolean res = false;
try {
- res = bobAccount.removeOneTimeKeys(bobSession);
+ bobAccount.removeOneTimeKeys(bobSession);
} catch (Exception e) {
assertTrue(e.getMessage(), false);
}
- assertTrue(res);
bobAccount.releaseAccount();
aliceAccount.releaseAccount();
@@ -1002,13 +994,11 @@ public class OlmSessionTest {
assertTrue(!aliceSession.matchesInboundSessionFrom(null,null));
// release objects
- boolean res = false;
try {
- res = bobAccount.removeOneTimeKeys(bobSession);
+ bobAccount.removeOneTimeKeys(bobSession);
} catch (Exception e) {
assertTrue(e.getMessage(), false);
}
- assertTrue(res);
aliceAccount.releaseAccount();
bobAccount.releaseAccount();
diff --git a/java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmUtilityTest.java b/java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmUtilityTest.java
index cc14e7c..b560bff 100644
--- a/java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmUtilityTest.java
+++ b/java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmUtilityTest.java
@@ -104,42 +104,34 @@ public class OlmUtilityTest {
}
// verify signature
- boolean isVerified;
-
- isVerified = false;
errorMsg = null;
try {
- isVerified = utility.verifyEd25519Signature(messageSignature, fingerPrintKey, message);
+ utility.verifyEd25519Signature(messageSignature, fingerPrintKey, message);
} catch (Exception e) {
errorMsg = e.getMessage();
}
- assertTrue(isVerified);
assertTrue(TextUtils.isEmpty(errorMsg));
// check a bad signature is detected => errorMsg = BAD_MESSAGE_MAC
String badSignature = "Bad signature Bad signature Bad signature..";
- isVerified = false;
errorMsg = null;
try {
- isVerified = utility.verifyEd25519Signature(badSignature, fingerPrintKey, message);
+ utility.verifyEd25519Signature(badSignature, fingerPrintKey, message);
} catch (Exception e) {
errorMsg = e.getMessage();
}
- assertFalse(isVerified);
assertTrue(!TextUtils.isEmpty(errorMsg));
// check bad fingerprint size => errorMsg = INVALID_BASE64
String badSizeFingerPrintKey = fingerPrintKey.substring(fingerPrintKey.length()/2);
- isVerified = false;
errorMsg = null;
try {
- isVerified = utility.verifyEd25519Signature(messageSignature, badSizeFingerPrintKey, message);
+ utility.verifyEd25519Signature(messageSignature, badSizeFingerPrintKey, message);
} catch (Exception e) {
errorMsg = e.getMessage();
}
- assertFalse(isVerified);
assertTrue(!TextUtils.isEmpty(errorMsg));
utility.releaseUtility();