Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
matrix-org
Olm
Commits
13d3f4a1
Commit
13d3f4a1
authored
Jan 09, 2017
by
ylecollen
Browse files
The serialization / deserialization unit test did not fail when there was an error
parent
f257580c
Changes
4
Hide whitespace changes
Inline
Side-by-side
java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmAccountTest.java
View file @
13d3f4a1
...
...
@@ -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
);
}
}
...
...
java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmGroupSessionTest.java
View file @
13d3f4a1
...
...
@@ -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
);
}
}
...
...
java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmSessionTest.java
View file @
13d3f4a1
...
...
@@ -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
);
}
}
...
...
java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmUtilityTest.java
View file @
13d3f4a1
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment