From caadb236f39b4b6139a697eec57aa2796595422f Mon Sep 17 00:00:00 2001 From: cyBerta Date: Tue, 21 May 2019 11:54:20 +0200 Subject: * show error dialog if provider is misconfigured and has not allowed registration nor anonymous usage * always download provider.json, Use preseeded provider.json only to check if the client can connect with preseeded certificate. Keeps the provider.json updated if provider changes it's config * Tests for both cases --- .../testutils/matchers/BundleMatcher.java | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'app/src/test/java/se/leap/bitmaskclient/testutils/matchers') diff --git a/app/src/test/java/se/leap/bitmaskclient/testutils/matchers/BundleMatcher.java b/app/src/test/java/se/leap/bitmaskclient/testutils/matchers/BundleMatcher.java index d2d2a102..49a44038 100644 --- a/app/src/test/java/se/leap/bitmaskclient/testutils/matchers/BundleMatcher.java +++ b/app/src/test/java/se/leap/bitmaskclient/testutils/matchers/BundleMatcher.java @@ -73,7 +73,7 @@ public class BundleMatcher extends BaseMatcher { if (unfoundExpectedInteger.get(key) == null) { description.appendText("\n unfound Integer in actual Bundle: ").appendValue(iterator.next()); } else { - description.appendText("\n expected Integer for key " + key).appendValue(expectedIntegers.get(key)). + description.appendText("\n expected Integer for key " + key + ": ").appendValue(expectedIntegers.get(key)). appendText("\n found Integer was: ").appendValue(unfoundExpectedInteger.get(key)); } } @@ -85,7 +85,7 @@ public class BundleMatcher extends BaseMatcher { if (unfoundExpectedBoolean.get(key) == null) { description.appendText("\n unfound Boolean in actual Bundle: ").appendValue(iterator.next()); } else { - description.appendText("\n expected Boolean for key " + key).appendValue(expectedBooleans.get(key)). + description.appendText("\n expected Boolean for key " + key + ": ").appendValue(expectedBooleans.get(key)). appendText("\n found Boolean was: ").appendValue(unfoundExpectedBoolean.get(key)); } } @@ -97,7 +97,7 @@ public class BundleMatcher extends BaseMatcher { if (unfoundExpectedString.get(key) == null) { description.appendText("\n unfound String in actual Bundle: ").appendValue(iterator.next()); } else { - description.appendText("\n expected String for key " + key).appendValue(expectedStrings.get(key)). + description.appendText("\n expected String for key " + key + ": ").appendValue(expectedStrings.get(key)). appendText("\n found String was: ").appendValue(unfoundExpectedString.get(key)); } } @@ -109,7 +109,7 @@ public class BundleMatcher extends BaseMatcher { if (unfoundExpectedParcelable.get(key) == null) { description.appendText("\n unfound Parcelable in actual Bundle: ").appendValue(iterator.next()); } else { - description.appendText("\n expected Parcelable or key " + key).appendValue(expectedParcelables.get(key)). + description.appendText("\n expected Parcelable or key " + key + ": ").appendValue(expectedParcelables.get(key)). appendText("\n found Parcelable was: ").appendValue(unfoundExpectedParcelable.get(key)); } } @@ -139,8 +139,7 @@ public class BundleMatcher extends BaseMatcher { Set booleanKeys = expectedBooleans.keySet(); for (String key : booleanKeys) { Object valueObject = actualBundle.get(key); - if (valueObject == null || - !(valueObject instanceof Boolean) || + if (!(valueObject instanceof Boolean) || valueObject != expectedBooleans.get(key)) { unfoundExpectedBoolean.put(key, (Boolean) valueObject); return false; @@ -153,8 +152,7 @@ public class BundleMatcher extends BaseMatcher { Set stringKeys = expectedStrings.keySet(); for (String key : stringKeys) { Object valueObject = actualBundle.get(key); - if (valueObject == null || - !(valueObject instanceof String) || + if (!(valueObject instanceof String) || !valueObject.equals(expectedStrings.get(key))) { unfoundExpectedString.put(key, (String) valueObject); return false; @@ -167,8 +165,7 @@ public class BundleMatcher extends BaseMatcher { Set stringKeys = expectedIntegers.keySet(); for (String key : stringKeys) { Object valueObject = actualBundle.get(key); - if (valueObject == null || - !(valueObject instanceof Integer) || + if (!(valueObject instanceof Integer) || ((Integer) valueObject).compareTo(expectedIntegers.get(key)) != 0) { unfoundExpectedInteger.put(key, (Integer) valueObject); return false; @@ -181,8 +178,7 @@ public class BundleMatcher extends BaseMatcher { Set stringKeys = expectedParcelables.keySet(); for (String key : stringKeys) { Object valueObject = actualBundle.get(key); - if (valueObject == null || - !(valueObject instanceof Parcelable) || + if (!(valueObject instanceof Parcelable) || !valueObject.equals(expectedParcelables.get(key))) { unfoundExpectedParcelable.put(key, (Parcelable) valueObject); return false; -- cgit v1.2.3