The serialization / deserialization unit test did not fail when there was an error
This commit is contained in:
parent
f257580cb1
commit
13d3f4a1c7
4 changed files with 37 additions and 3 deletions
|
@ -96,6 +96,7 @@ public class OlmAccountTest {
|
||||||
mOlmAccount = new OlmAccount();
|
mOlmAccount = new OlmAccount();
|
||||||
} catch (OlmException e) {
|
} catch (OlmException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
assertTrue("OlmAccount failed " + e.getMessage(), false);
|
||||||
}
|
}
|
||||||
assertNotNull(mOlmAccount);
|
assertNotNull(mOlmAccount);
|
||||||
|
|
||||||
|
@ -109,6 +110,7 @@ public class OlmAccountTest {
|
||||||
mOlmAccount = new OlmAccount();
|
mOlmAccount = new OlmAccount();
|
||||||
} catch (OlmException e) {
|
} catch (OlmException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
assertTrue("OlmAccount failed " + e.getMessage(), false);
|
||||||
}
|
}
|
||||||
assertNotNull(mOlmAccount);
|
assertNotNull(mOlmAccount);
|
||||||
mIsAccountCreated = true;
|
mIsAccountCreated = true;
|
||||||
|
@ -261,7 +263,7 @@ public class OlmAccountTest {
|
||||||
FileOutputStream fileOutput;
|
FileOutputStream fileOutput;
|
||||||
ObjectOutputStream objectOutput;
|
ObjectOutputStream objectOutput;
|
||||||
OlmAccount accountRef = null;
|
OlmAccount accountRef = null;
|
||||||
OlmAccount accountDeserial;
|
OlmAccount accountDeserial = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
accountRef = new OlmAccount();
|
accountRef = new OlmAccount();
|
||||||
|
@ -330,18 +332,22 @@ public class OlmAccountTest {
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException e) {
|
catch (FileNotFoundException e) {
|
||||||
Log.e(LOG_TAG, "## test13Serialization(): Exception FileNotFoundException Msg=="+e.getMessage());
|
Log.e(LOG_TAG, "## test13Serialization(): Exception FileNotFoundException Msg=="+e.getMessage());
|
||||||
|
assertTrue("test13Serialization failed " + e.getMessage(), false);
|
||||||
}
|
}
|
||||||
catch (ClassNotFoundException e) {
|
catch (ClassNotFoundException e) {
|
||||||
Log.e(LOG_TAG, "## test13Serialization(): Exception ClassNotFoundException Msg==" + e.getMessage());
|
Log.e(LOG_TAG, "## test13Serialization(): Exception ClassNotFoundException Msg==" + e.getMessage());
|
||||||
|
assertTrue("test13Serialization failed " + e.getMessage(), false);
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
Log.e(LOG_TAG, "## test13Serialization(): Exception IOException Msg==" + e.getMessage());
|
Log.e(LOG_TAG, "## test13Serialization(): Exception IOException Msg==" + e.getMessage());
|
||||||
|
assertTrue("test13Serialization failed " + e.getMessage(), false);
|
||||||
}
|
}
|
||||||
/*catch (OlmException e) {
|
/*catch (OlmException e) {
|
||||||
Log.e(LOG_TAG, "## test13Serialization(): Exception OlmException Msg==" + e.getMessage());
|
Log.e(LOG_TAG, "## test13Serialization(): Exception OlmException Msg==" + e.getMessage());
|
||||||
}*/
|
}*/
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Log.e(LOG_TAG, "## test13Serialization(): Exception Msg==" + e.getMessage());
|
Log.e(LOG_TAG, "## test13Serialization(): Exception Msg==" + e.getMessage());
|
||||||
|
assertTrue("test13Serialization failed " + e.getMessage(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,6 +175,7 @@ public class OlmGroupSessionTest {
|
||||||
try {
|
try {
|
||||||
result = mBobInboundGroupSession.decryptMessage(mAliceToBobMessage);
|
result = mBobInboundGroupSession.decryptMessage(mAliceToBobMessage);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
assertTrue(e.getMessage(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// test decrypted message
|
// test decrypted message
|
||||||
|
@ -262,14 +263,19 @@ public class OlmGroupSessionTest {
|
||||||
assertTrue(outboundGroupSessionSerial.isReleased());
|
assertTrue(outboundGroupSessionSerial.isReleased());
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
Log.e(LOG_TAG, "## test15SerializeOutboundSession(): Exception FileNotFoundException Msg=="+e.getMessage());
|
Log.e(LOG_TAG, "## test15SerializeOutboundSession(): Exception FileNotFoundException Msg=="+e.getMessage());
|
||||||
|
assertTrue(e.getMessage(), false);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
Log.e(LOG_TAG, "## test15SerializeOutboundSession(): Exception ClassNotFoundException Msg==" + e.getMessage());
|
Log.e(LOG_TAG, "## test15SerializeOutboundSession(): Exception ClassNotFoundException Msg==" + e.getMessage());
|
||||||
|
assertTrue(e.getMessage(), false);
|
||||||
} catch (OlmException e) {
|
} catch (OlmException e) {
|
||||||
Log.e(LOG_TAG, "## test15SerializeOutboundSession(): Exception OlmException Msg==" + e.getMessage());
|
Log.e(LOG_TAG, "## test15SerializeOutboundSession(): Exception OlmException Msg==" + e.getMessage());
|
||||||
|
assertTrue(e.getMessage(), false);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(LOG_TAG, "## test15SerializeOutboundSession(): Exception IOException Msg==" + e.getMessage());
|
Log.e(LOG_TAG, "## test15SerializeOutboundSession(): Exception IOException Msg==" + e.getMessage());
|
||||||
|
assertTrue(e.getMessage(), false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(LOG_TAG, "## test15SerializeOutboundSession(): Exception Msg==" + e.getMessage());
|
Log.e(LOG_TAG, "## test15SerializeOutboundSession(): Exception Msg==" + e.getMessage());
|
||||||
|
assertTrue(e.getMessage(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,14 +348,19 @@ public class OlmGroupSessionTest {
|
||||||
assertTrue(bobInboundGroupSessionSerial.isReleased());
|
assertTrue(bobInboundGroupSessionSerial.isReleased());
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
Log.e(LOG_TAG, "## test16SerializeInboundSession(): Exception FileNotFoundException Msg=="+e.getMessage());
|
Log.e(LOG_TAG, "## test16SerializeInboundSession(): Exception FileNotFoundException Msg=="+e.getMessage());
|
||||||
|
assertTrue(e.getMessage(), false);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
Log.e(LOG_TAG, "## test16SerializeInboundSession(): Exception ClassNotFoundException Msg==" + e.getMessage());
|
Log.e(LOG_TAG, "## test16SerializeInboundSession(): Exception ClassNotFoundException Msg==" + e.getMessage());
|
||||||
|
assertTrue(e.getMessage(), false);
|
||||||
} catch (OlmException e) {
|
} catch (OlmException e) {
|
||||||
Log.e(LOG_TAG, "## test16SerializeInboundSession(): Exception OlmException Msg==" + e.getMessage());
|
Log.e(LOG_TAG, "## test16SerializeInboundSession(): Exception OlmException Msg==" + e.getMessage());
|
||||||
|
assertTrue(e.getMessage(), false);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(LOG_TAG, "## test16SerializeInboundSession(): Exception IOException Msg==" + e.getMessage());
|
Log.e(LOG_TAG, "## test16SerializeInboundSession(): Exception IOException Msg==" + e.getMessage());
|
||||||
|
assertTrue(e.getMessage(), false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(LOG_TAG, "## test16SerializeInboundSession(): Exception Msg==" + e.getMessage());
|
Log.e(LOG_TAG, "## test16SerializeInboundSession(): Exception Msg==" + e.getMessage());
|
||||||
|
assertTrue(e.getMessage(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -454,6 +454,7 @@ public class OlmSessionTest {
|
||||||
bobSession = new OlmSession();
|
bobSession = new OlmSession();
|
||||||
} catch (OlmException e) {
|
} catch (OlmException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
assertTrue(e.getMessage(), false);
|
||||||
}
|
}
|
||||||
assertTrue(0!=bobSession.getOlmSessionId());
|
assertTrue(0!=bobSession.getOlmSessionId());
|
||||||
|
|
||||||
|
@ -803,18 +804,22 @@ public class OlmSessionTest {
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException e) {
|
catch (FileNotFoundException e) {
|
||||||
Log.e(LOG_TAG, "## test03SessionSerialization(): Exception FileNotFoundException Msg=="+e.getMessage());
|
Log.e(LOG_TAG, "## test03SessionSerialization(): Exception FileNotFoundException Msg=="+e.getMessage());
|
||||||
|
assertTrue(e.getMessage(), false);
|
||||||
}
|
}
|
||||||
catch (ClassNotFoundException e) {
|
catch (ClassNotFoundException e) {
|
||||||
Log.e(LOG_TAG, "## test03SessionSerialization(): Exception ClassNotFoundException Msg==" + e.getMessage());
|
Log.e(LOG_TAG, "## test03SessionSerialization(): Exception ClassNotFoundException Msg==" + e.getMessage());
|
||||||
|
assertTrue(e.getMessage(), false);
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
Log.e(LOG_TAG, "## test03SessionSerialization(): Exception IOException Msg==" + e.getMessage());
|
Log.e(LOG_TAG, "## test03SessionSerialization(): Exception IOException Msg==" + e.getMessage());
|
||||||
|
assertTrue(e.getMessage(), false);
|
||||||
}
|
}
|
||||||
/*catch (OlmException e) {
|
/*catch (OlmException e) {
|
||||||
Log.e(LOG_TAG, "## test03SessionSerialization(): Exception OlmException Msg==" + e.getMessage());
|
Log.e(LOG_TAG, "## test03SessionSerialization(): Exception OlmException Msg==" + e.getMessage());
|
||||||
}*/
|
}*/
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Log.e(LOG_TAG, "## test03SessionSerialization(): Exception Msg==" + e.getMessage());
|
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));
|
assertTrue("fingerprint key missing",!TextUtils.isEmpty(fingerPrintKey));
|
||||||
|
|
||||||
// instantiate utility object
|
// 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
|
// verify signature
|
||||||
boolean isVerified;
|
boolean isVerified;
|
||||||
|
@ -145,7 +151,13 @@ public class OlmUtilityTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test02sha256() {
|
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 msgToHash = "The quick brown fox jumps over the lazy dog";
|
||||||
|
|
||||||
String hashResult = utility.sha256(msgToHash);
|
String hashResult = utility.sha256(msgToHash);
|
||||||
|
|
Loading…
Reference in a new issue