Package rabbit.ui.internal.util

Examples of rabbit.ui.internal.util.ICategoryProvider


    ICategory[] categories = {Category.DATE, Category.WORKSPACE};
    List<TreePath> expected = asList(
        newPath(date, ws, duration),
        newPath(date, ws, duration));

    ICategoryProvider provider = mock(ICategoryProvider.class);
    given(provider.getSelected()).willReturn(asList(categories));
    ITreePathBuilder builder = create(provider);

    IFileDataProvider input = mock(IFileDataProvider.class);
    given(input.get()).willReturn(asList(data, data));
    List<TreePath> actual = builder.build(input);
View Full Code Here


  private ITreePathBuilder builder;

  @Before
  public void before() {
    Collection<ICategory> noCategories = emptySet();
    ICategoryProvider p = mock(ICategoryProvider.class);
    given(p.getAllSupported()).willReturn(noCategories);
    builder = create(p);
  }
View Full Code Here

  }

  @Test(expected = NullPointerException.class)
  public void constructorShouldThrowAnExceptionIfTheKeyMapIsNull() {
    // Testing the abstract class only:
    ICategoryProvider p = mock(ICategoryProvider.class);
    given(p.getAllSupported()).willReturn(Collections.<ICategory> emptySet());
    given(p.getSelected()).willReturn(Collections.<ICategory> emptyList());
    given(p.getUnselected()).willReturn(Collections.<ICategory> emptySet());
    new AbstractDataTreeBuilder<IData>(p, null) {
      @Override
      protected Collection<IData> getData(Object input) {
        return emptySet();
      }
View Full Code Here

  public void runShouldSetTheCategories() {
    @SuppressWarnings("serial")
    class MyException extends RuntimeException {}

    ICategory[] categories = {mock(ICategory.class), mock(ICategory.class)};
    ICategoryProvider provider = mock(ICategoryProvider.class);
    doThrow(new MyException()).when(provider).setSelected(categories);

    IAction action = create(provider, categories);
    thrown.expect(MyException.class);
    action.run();
View Full Code Here

  public void shouldCorrectlyBuildASinglePath() {
    ICategory[] categories = {
        Category.DATE, Category.WORKSPACE, Category.WORKBENCH_TOOL};
    List<TreePath> expected = asList(newPath(date, ws, view, duration));

    ICategoryProvider provider = mock(ICategoryProvider.class);
    given(provider.getSelected()).willReturn(asList(categories));
    ITreePathBuilder builder = create(provider);

    IPartDataProvider input = mock(IPartDataProvider.class);
    given(input.get()).willReturn(asList(data));
    List<TreePath> actual = builder.build(input);
View Full Code Here

    given(data.get(IPartData.DATE)).willReturn(date);
    given(data.get(IPartData.DURATION)).willReturn(duration);
    given(data.get(IPartData.PART_ID)).willReturn(undefined.getId());
    given(data.get(IPartData.WORKSPACE)).willReturn(ws);

    ICategoryProvider provider = mock(ICategoryProvider.class);
    given(provider.getSelected()).willReturn(asList(categories));
    ITreePathBuilder builder = create(provider);

    IPartDataProvider input = mock(IPartDataProvider.class);
    given(input.get()).willReturn(asList(data));
    List<TreePath> actual = builder.build(input);
View Full Code Here

    given(data2.get(IPartData.DATE)).willReturn(date2);
    given(data2.get(IPartData.DURATION)).willReturn(duration2);
    given(data2.get(IPartData.PART_ID)).willReturn(editor.getId());
    given(data2.get(IPartData.WORKSPACE)).willReturn(ws2);

    ICategoryProvider provider = mock(ICategoryProvider.class);
    given(provider.getSelected()).willReturn(asList(categories));
    ITreePathBuilder builder = create(provider);

    IPartDataProvider input = mock(IPartDataProvider.class);
    given(input.get()).willReturn(asList(data, data2));
    List<TreePath> actual = builder.build(input);
View Full Code Here

    ICategory[] categories = {Category.DATE, Category.WORKSPACE};
    List<TreePath> expected = asList(
        newPath(date, ws, duration),
        newPath(date, ws, duration));

    ICategoryProvider provider = mock(ICategoryProvider.class);
    given(provider.getSelected()).willReturn(asList(categories));
    ITreePathBuilder builder = create(provider);

    IPartDataProvider input = mock(IPartDataProvider.class);
    given(input.get()).willReturn(asList(data, data));
    List<TreePath> actual = builder.build(input);
View Full Code Here

  }

  @Test
  public void restoreCategoriesShouldDoNothingIfNoCategoriesHaveBeenSaved() {
    ICategory[] categories = {DATE, FILE};
    ICategoryProvider provider = new CategoryProvider(categories, categories);
    helper.restoreCategories(provider);
    assertThat(provider.getSelected(), equalTo(asList(categories)));
  }
View Full Code Here

    column.setWidth(width);

    // For saving the selected categories:
    final List<Category> expectedCategories = asList(DATE, FILE);
    final List<Category> actualCategories = Lists.newArrayList();
    ICategoryProvider categoryProvider = mock(ICategoryProvider.class);
    doAnswer(new Answer<Void>() {
      @Override
      public Void answer(InvocationOnMock invocation) throws Throwable {
        for (Object obj : invocation.getArguments()) {
          actualCategories.add((Category) obj);
        }
        return null;
      }
    }).when(categoryProvider)
        .setSelected(expectedCategories.toArray(new Category[0]));

    // Save the states:
    helper
        .saveCategories(expectedCategories.toArray(new Category[0]))
        .saveVisualCategory(visualCategory)
        .saveColumnWidths(new TreeColumn[]{column});

    // Change the states:
    categoryProvider.setSelected(FILE);
    valueProvider.setVisualCategory(DATE);
    column.setWidth(1);

    // Restore:
    helper
View Full Code Here

TOP

Related Classes of rabbit.ui.internal.util.ICategoryProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.