private static void assertThemeUsed(ActionBarIconGenerator.Theme theme, @Nullable Color color)
      throws Exception {
    ArgumentCaptor<ActionBarIconGenerator.ActionBarOptions> argument =
        ArgumentCaptor.forClass(ActionBarIconGenerator.ActionBarOptions.class);

    ActionBarIconGenerator generator = mock(ActionBarIconGenerator.class);

    TemplateWizardState state = new TemplateWizardState();
    AssetStudioAssetGenerator studioGenerator =
        new AssetStudioAssetGenerator(
            new TemplateWizardContextAdapter(state), generator, null, null);
    pickImage(state);
    state.put(ATTR_ASSET_TYPE, AssetType.ACTIONBAR.name());
    state.put(ATTR_ASSET_THEME, theme.name());
    state.put(ATTR_FOREGROUND_COLOR, color);
    studioGenerator.generateImages(true);

    verify(generator, times(1))
        .generate(
            isNull(String.class),
            any(Map.class),
            eq(studioGenerator),
            argument.capture(),
            anyString());

    assertEquals(theme, argument.getValue().theme);

    if (color != null && theme.equals(ActionBarIconGenerator.Theme.CUSTOM)) {
      assertEquals(color.getRGB(), argument.getValue().customThemeColor);
    }
  }
  public void testActionBarIcons() throws Exception {
    myState.put(ATTR_ASSET_TYPE, AssetType.ACTIONBAR.name());
    myAssetGenerator.generateImages(true);

    verify(myNotificationIconGenerator, never())
        .generate(any(GraphicGeneratorContext.class), any(GraphicGenerator.Options.class));
    verify(myNotificationIconGenerator, never())
        .generate(
            anyString(),
            any(Map.class),
            any(GraphicGeneratorContext.class),
            any(GraphicGenerator.Options.class),
            anyString());

    verify(myActionBarIconGenerator, never())
        .generate(eq(myAssetGenerator), any(ActionBarIconGenerator.ActionBarOptions.class));
    verify(myActionBarIconGenerator, times(1))
        .generate(
            isNull(String.class),
            any(Map.class),
            eq(myAssetGenerator),
            any(ActionBarIconGenerator.ActionBarOptions.class),
            eq(ASSET_NAME));

    verify(myLauncherIconGenerator, never())
        .generate(any(GraphicGeneratorContext.class), any(GraphicGenerator.Options.class));
    verify(myLauncherIconGenerator, never())
        .generate(
            anyString(),
            any(Map.class),
            any(GraphicGeneratorContext.class),
            any(GraphicGenerator.Options.class),
            anyString());
  }
  private ArgumentCaptor<ActionBarIconGenerator.ActionBarOptions> runImageTest() throws Exception {
    ArgumentCaptor<ActionBarIconGenerator.ActionBarOptions> argument =
        ArgumentCaptor.forClass(ActionBarIconGenerator.ActionBarOptions.class);
    myState.put(ATTR_ASSET_TYPE, AssetType.ACTIONBAR.name());
    myState.put(ATTR_ASSET_THEME, ActionBarIconGenerator.Theme.HOLO_DARK.name());

    myAssetGenerator.generateImages(true);

    verify(myActionBarIconGenerator, times(1))
        .generate(
            isNull(String.class),
            any(Map.class),
            eq(myAssetGenerator),
            argument.capture(),
            anyString());

    return argument;
  }