diff options
Diffstat (limited to 'java/android/OlmLibSdk/olm-sdk/src')
4 files changed, 37 insertions, 3 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 569b520..699d966 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 @@ -96,6 +96,7 @@ public class OlmAccountTest { mOlmAccount = new OlmAccount(); } catch (OlmException e) { e.printStackTrace(); + assertTrue("OlmAccount failed " + e.getMessage(), false); } assertNotNull(mOlmAccount); @@ -109,6 +110,7 @@ public class OlmAccountTest { mOlmAccount = new OlmAccount(); } catch (OlmException e) { e.printStackTrace(); + assertTrue("OlmAccount failed " + e.getMessage(), false); } assertNotNull(mOlmAccount); mIsAccountCreated = true; @@ -261,7 +263,7 @@ public class OlmAccountTest { FileOutputStream fileOutput; ObjectOutputStream objectOutput; OlmAccount accountRef = null; - OlmAccount accountDeserial; + OlmAccount accountDeserial = null; try { accountRef = new OlmAccount(); @@ -330,18 +332,22 @@ public class OlmAccountTest { } catch (FileNotFoundException e) { Log.e(LOG_TAG, "## test13Serialization(): Exception FileNotFoundException Msg=="+e.getMessage()); + assertTrue("test13Serialization failed " + e.getMessage(), false); } catch (ClassNotFoundException e) { Log.e(LOG_TAG, "## test13Serialization(): Exception ClassNotFoundException Msg==" + e.getMessage()); + assertTrue("test13Serialization failed " + e.getMessage(), false); } catch (IOException e) { Log.e(LOG_TAG, "## test13Serialization(): Exception IOException Msg==" + e.getMessage()); + assertTrue("test13Serialization failed " + e.getMessage(), false); } /*catch (OlmException e) { Log.e(LOG_TAG, "## test13Serialization(): Exception OlmException Msg==" + e.getMessage()); }*/ catch (Exception e) { Log.e(LOG_TAG, "## test13Serialization(): Exception Msg==" + e.getMessage()); + assertTrue("test13Serialization failed " + e.getMessage(), false); } } diff --git a/java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmGroupSessionTest.java b/java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmGroupSessionTest.java index c532179..9be6375 100644 --- a/java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmGroupSessionTest.java +++ b/java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmGroupSessionTest.java @@ -175,6 +175,7 @@ public class OlmGroupSessionTest { try { result = mBobInboundGroupSession.decryptMessage(mAliceToBobMessage); } catch (Exception e) { + assertTrue(e.getMessage(), false); } // test decrypted message @@ -262,14 +263,19 @@ public class OlmGroupSessionTest { assertTrue(outboundGroupSessionSerial.isReleased()); } catch (FileNotFoundException e) { Log.e(LOG_TAG, "## test15SerializeOutboundSession(): Exception FileNotFoundException Msg=="+e.getMessage()); + assertTrue(e.getMessage(), false); } catch (ClassNotFoundException e) { Log.e(LOG_TAG, "## test15SerializeOutboundSession(): Exception ClassNotFoundException Msg==" + e.getMessage()); + assertTrue(e.getMessage(), false); } catch (OlmException e) { Log.e(LOG_TAG, "## test15SerializeOutboundSession(): Exception OlmException Msg==" + e.getMessage()); + assertTrue(e.getMessage(), false); } catch (IOException e) { Log.e(LOG_TAG, "## test15SerializeOutboundSession(): Exception IOException Msg==" + e.getMessage()); + assertTrue(e.getMessage(), false); } catch (Exception e) { Log.e(LOG_TAG, "## test15SerializeOutboundSession(): Exception Msg==" + e.getMessage()); + assertTrue(e.getMessage(), false); } } @@ -342,14 +348,19 @@ public class OlmGroupSessionTest { assertTrue(bobInboundGroupSessionSerial.isReleased()); } catch (FileNotFoundException e) { Log.e(LOG_TAG, "## test16SerializeInboundSession(): Exception FileNotFoundException Msg=="+e.getMessage()); + assertTrue(e.getMessage(), false); } catch (ClassNotFoundException e) { Log.e(LOG_TAG, "## test16SerializeInboundSession(): Exception ClassNotFoundException Msg==" + e.getMessage()); + assertTrue(e.getMessage(), false); } catch (OlmException e) { Log.e(LOG_TAG, "## test16SerializeInboundSession(): Exception OlmException Msg==" + e.getMessage()); + assertTrue(e.getMessage(), false); } catch (IOException e) { Log.e(LOG_TAG, "## test16SerializeInboundSession(): Exception IOException Msg==" + e.getMessage()); + assertTrue(e.getMessage(), false); } catch (Exception e) { Log.e(LOG_TAG, "## test16SerializeInboundSession(): Exception Msg==" + e.getMessage()); + assertTrue(e.getMessage(), false); } } 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 ec2582f..bb24f7a 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 @@ -454,6 +454,7 @@ public class OlmSessionTest { bobSession = new OlmSession(); } catch (OlmException e) { e.printStackTrace(); + assertTrue(e.getMessage(), false); } assertTrue(0!=bobSession.getOlmSessionId()); @@ -803,18 +804,22 @@ public class OlmSessionTest { } catch (FileNotFoundException e) { Log.e(LOG_TAG, "## test03SessionSerialization(): Exception FileNotFoundException Msg=="+e.getMessage()); + assertTrue(e.getMessage(), false); } catch (ClassNotFoundException e) { Log.e(LOG_TAG, "## test03SessionSerialization(): Exception ClassNotFoundException Msg==" + e.getMessage()); + assertTrue(e.getMessage(), false); } catch (IOException e) { Log.e(LOG_TAG, "## test03SessionSerialization(): Exception IOException Msg==" + e.getMessage()); + assertTrue(e.getMessage(), false); } /*catch (OlmException e) { Log.e(LOG_TAG, "## test03SessionSerialization(): Exception OlmException Msg==" + e.getMessage()); }*/ catch (Exception e) { Log.e(LOG_TAG, "## test03SessionSerialization(): Exception Msg==" + e.getMessage()); + assertTrue(e.getMessage(), false); } } 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 bd53e6e..cc14e7c 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 @@ -95,7 +95,13 @@ public class OlmUtilityTest { assertTrue("fingerprint key missing",!TextUtils.isEmpty(fingerPrintKey)); // instantiate utility object - OlmUtility utility = new OlmUtility(); + OlmUtility utility = null; + + try { + utility = new OlmUtility(); + } catch (Exception e) { + assertTrue("failed to create OlmUtility", false); + } // verify signature boolean isVerified; @@ -145,7 +151,13 @@ public class OlmUtilityTest { @Test public void test02sha256() { - OlmUtility utility = new OlmUtility(); + OlmUtility utility = null; + + try { + utility = new OlmUtility(); + } catch (Exception e) { + assertTrue("OlmUtility creation failed", false); + } String msgToHash = "The quick brown fox jumps over the lazy dog"; String hashResult = utility.sha256(msgToHash); |