@Test public void shouldGetComponentFromContext() { Object component = Components.fromContext(RuntimeEnvironment.application); TestApplication testApplication = (TestApplication) RuntimeEnvironment.application; assertThat(component).isEqualTo(testApplication.getComponent()); }
@NonNull @SuppressWarnings("unchecked") public static <T> T fromContext(@NonNull Context context) { checkNotNull(context); return ((HasComponent<T>) context.getApplicationContext()).getComponent(); }
Components { @NonNull @SuppressWarnings("unchecked") public static <T> T fromContext(@NonNull Context context) { checkNotNull(context); return ((HasComponent<T>) context.getApplicationContext()).getComponent(); } }
Components { @NonNull @SuppressWarnings("unchecked") public static <T> T fromContext(@NonNull Context context) { checkNotNull(context); return ((HasComponent<T>) context.getApplicationContext()).getComponent(); }  }
Components { @NonNull @SuppressWarnings("unchecked") public static <T> T fromContext(@NonNull Context context) { checkNotNull(context); return ((HasComponent<T>) context.getApplicationContext()).getComponent(); }  @NonNull @SuppressWarnings("unchecked") static T fromContext(@NonNull Context context); }
Components { @NonNull @SuppressWarnings("unchecked") public static <T> T fromContext(@NonNull Context context) { checkNotNull(context); return ((HasComponent<T>) context.getApplicationContext()).getComponent(); }  @NonNull @SuppressWarnings("unchecked") static T fromContext(@NonNull Context context);  }