use of java.util.Arrays.asList in project n4js by eclipse.
the class GHOLD_101_WorkingSetsTest_PluginUITest method tearDown.
@Override
public void tearDown() throws Exception {
super.tearDown();
broker.resetState();
waitForIdleState();
final TreeItem[] treeItems = commonViewer.getTree().getItems();
assertTrue("Expected empty Project Explorer. Input was: " + Arrays.toString(treeItems), Arrays2.isEmpty(treeItems));
assertFalse("Expected projects as top level elements in navigator.", broker.isWorkingSetTopLevel());
assertNull("Select working set drop down contribution was visible when projects are configured as top level elements.", getWorkingSetDropDownContribution());
IContributionItem showHiddenWorkingSetsItem = from(Arrays.asList(projectExplorer.getViewSite().getActionBars().getToolBarManager().getItems())).firstMatch(i -> ShowHiddenWorkingSetsDropDownAction.class.getName().equals(i.getId())).orNull();
assertNull("Show hidden working set drop down contribution was visible when projects are configured as top level elements.", showHiddenWorkingSetsItem);
}
use of java.util.Arrays.asList in project n4js by eclipse.
the class SelectAllProjectExplorer_PluginUITest method getContextMenuContributions.
/**
* Returns the menu contribution titles of the project navigator context menu.
*
* This only includes {@link ActionContributionItem}s and {@link MenuManager}s.
*/
private List<String> getContextMenuContributions() {
MenuManager menu = new MenuManager();
projectExplorer.getNavigatorActionService().fillContextMenu(menu);
return Arrays.asList(menu.getItems()).stream().map(i -> {
if (i instanceof ActionContributionItem) {
// use action name
return ((ActionContributionItem) i).getAction().getText();
} else if (i instanceof MenuManager) {
// use sub-menu title
return ((MenuManager) i).getMenuText();
} else {
// null for other types of contributions
return null;
}
}).filter(t -> null != t).map(text -> LegacyActionTools.removeMnemonics(text)).collect(Collectors.toList());
}
use of java.util.Arrays.asList in project n4js by eclipse.
the class SelectAllProjectExplorer_PluginUITest method assertContextMenuNoActionDuplicates.
/**
* Asserts that the context menu for the current navigator selection does not contain any duplicates.
*
* That is, two menu items that represent an action of the same class.
*/
private void assertContextMenuNoActionDuplicates() {
MenuManager menu = new MenuManager();
projectExplorer.getNavigatorActionService().fillContextMenu(menu);
List<ActionContributionItem> actionContributions = Arrays.asList(menu.getItems()).stream().filter(i -> i instanceof ActionContributionItem).map(i -> ((ActionContributionItem) i)).collect(Collectors.toList());
Map<String, ActionContributionItem> contributionNameMap = new HashMap<>();
for (ActionContributionItem item : actionContributions) {
ActionContributionItem mapItem = contributionNameMap.putIfAbsent(item.getAction().getText(), item);
if (mapItem != null) {
IAction mapAction = mapItem.getAction();
IAction otherAction = item.getAction();
// Double check if action is of the same type
if (mapAction.getClass().equals(otherAction.getClass())) {
fail("Action '" + mapAction.getClass().getSimpleName() + "' is contributed twice to the context menu: " + mapAction.toString() + " " + otherAction.toString());
}
}
}
}
use of java.util.Arrays.asList in project n4js by eclipse.
the class SelectAllProjectExplorer_PluginUITest method tearDown.
@Override
public void tearDown() throws Exception {
super.tearDown();
broker.resetState();
waitForIdleState();
final TreeItem[] treeItems = commonViewer.getTree().getItems();
assertTrue("Expected empty Project Explorer. Input was: " + Arrays.toString(treeItems), Arrays2.isEmpty(treeItems));
assertFalse("Expected projects as top level elements in navigator.", broker.isWorkingSetTopLevel());
assertNull("Select working set drop down contribution was visible when projects are configured as top level elements.", getWorkingSetDropDownContribution());
IContributionItem showHiddenWorkingSetsItem = from(Arrays.asList(projectExplorer.getViewSite().getActionBars().getToolBarManager().getItems())).firstMatch(i -> ShowHiddenWorkingSetsDropDownAction.class.getName().equals(i.getId())).orNull();
assertNull("Show hidden working set drop down contribution was visible when projects are configured as top level elements.", showHiddenWorkingSetsItem);
}
use of java.util.Arrays.asList in project motech by motech.
the class LookupProcessorTest method shouldProcessMethodWithCustomLookupName.
@Test
public void shouldProcessMethodWithCustomLookupName() throws NoSuchMethodException {
lookupProcessor.setEntityProcessingResult(Arrays.asList(mockEntityProcessorOutput(new EntityDto(TestClass.class.getName()), Collections.EMPTY_LIST)));
when(paranamer.lookupParameterNames(getTestMethod(3))).thenReturn(argNames);
Method method = getTestMethod(3);
LookupDto dto = new LookupDto("My new custom lookup", false, false, lookupFieldDtos(argNames), true, "testMethod3", asList(argNames), true);
lookupProcessor.process(method);
Map<String, List<LookupDto>> elements = lookupProcessor.getProcessingResult();
assertTrue(elements.containsKey(TEST_CLASS_NAME));
List<LookupDto> list = elements.get(TEST_CLASS_NAME);
assertEquals(1, list.size());
assertEquals(dto, list.get(0));
}
Aggregations