Skip to content
Snippets Groups Projects
Commit 13d3f4a1 authored by ylecollen's avatar ylecollen
Browse files

The serialization / deserialization unit test did not fail when there was an error

parent f257580c
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
}
......
......@@ -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);
}
}
......
......@@ -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);
}
}
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment