MortarScope { public static MortarScope getScope(Context context) { Object scope = context.getSystemService(MORTAR_SERVICE); if (scope == null) { scope = context.getApplicationContext().getSystemService(MORTAR_SERVICE); } return (MortarScope) scope; } MortarScope(String name, MortarScope parent, Map<String, Object> services); static MortarScope getScope(Context context); static MortarScope findChild(Context context, String name); static Builder buildChild(Context context); static boolean isDestroyed(Context context); static Builder buildRootScope(); final String getName(); String getPath(); boolean hasService(String serviceName); T getService(String serviceName); void register(Scoped scoped); MortarScope findChild(String childName); Builder buildChild(); Context createContext(Context parentContext); boolean isDestroyed(); void destroy(); @Override String toString(); static final String DIVIDER; }
@Test public void getScope() { MortarScope root = scopeBuilder.build("root"); Context context = mockContext(root); assertThat(MortarScope.getScope(context)).isSameAs(root); }