Code example for ComponentName

0
    assertEquals(shadowAppWidgetManager.bindAppWidgetIdIfAllowed(12345, new ComponentName("", "")), true);
  } 
 
  @Test 
  public void bindAppWidgetIdIfAllowed_shouldRecordTheBinding() throws Exception { 
    ComponentName provider = new ComponentName("A", "B");
    appWidgetManager.bindAppWidgetIdIfAllowed(789, provider);
    assertArrayEquals(new int[]{789}, appWidgetManager.getAppWidgetIds(provider));
  } 
 
  @Test 
  public void bindAppWidgetId_shouldRecordAppWidgetInfo() throws Exception { 
    ComponentName provider = new ComponentName("abc", "123");
    AppWidgetProviderInfo providerInfo = new AppWidgetProviderInfo();
    providerInfo.provider = provider;
    shadowAppWidgetManager.addInstalledProvider(providerInfo);
 
    appWidgetManager.bindAppWidgetIdIfAllowed(90210, provider);
 
    assertSame(providerInfo, appWidgetManager.getAppWidgetInfo(90210));
  }