SubscriptionsManager { @NonNull WritableMap toWritableMap() { WritableMap result = Arguments.createMap(); try { latch.await(); for (final String typeName: subscriptions.keySet()) { final Map<String, Set<String>> subtypes = subscriptions.get(typeName); if (subtypes == null) { continue; } final WritableMap map = Arguments.createMap(); for (final String subtypeName: subtypes.keySet()) { final Set<String> idsSet = subtypes.get(subtypeName); if (idsSet == null) { continue; } final WritableArray ids = Arguments.fromArray(idsSet.toArray(new String[0])); map.putArray(subtypeName, ids); } result.putMap(typeName, map); } } catch (InterruptedException e) { Timber.e("Interrupted"); } return result; } SubscriptionsManager(Context context); @UiThread void addSubscription(String type, String subType, String id); @UiThread void removeSubscription(String type, String subType, String id); boolean isSubscribed(String type, String subtype, String value); @UiThread void resetSubscriptions();  }
@Test(timeout = 1000L) public void canCreateInstance() { WritableMap map = mSubscriptionsManager.toWritableMap(); assertFalse(map.keySetIterator().hasNextKey()); }