use of org.freeplane.features.mode.FreeplaneActions in project freeplane by freeplane.
the class ActionFinderTest method attachesExistingFreeplaneAction.
@Test
public void attachesExistingFreeplaneAction() {
FreeplaneActions freeplaneActions = mock(FreeplaneActions.class);
Entry entry = new Entry();
entry.setName("action");
final AFreeplaneAction someAction = Mockito.mock(AFreeplaneAction.class);
when(freeplaneActions.getAction("action")).thenReturn(someAction);
final ActionFinder actionFinder = new ActionFinder(freeplaneActions);
actionFinder.visit(entry);
assertThat((AFreeplaneAction) new EntryAccessor().getAction(entry), CoreMatchers.equalTo(someAction));
}
use of org.freeplane.features.mode.FreeplaneActions in project freeplane by freeplane.
the class MenuBuilderIntegrationTest method setup.
@Before
public void setup() {
freeplaneActions = mock(FreeplaneActions.class);
recursiveMenuStructureBuilder = new RecursiveMenuStructureProcessor();
recursiveMenuStructureBuilder.setDefaultBuilderPair(EntryVisitor.EMTPY, EntryVisitor.EMTPY);
final IUserInputListenerFactory userInputListenerFactory = mock(IUserInputListenerFactory.class);
toolbar = new JToolBar();
when(userInputListenerFactory.getToolBar("/main_toolbar")).thenReturn(toolbar);
recursiveMenuStructureBuilder.addBuilder("toolbar", new JToolbarBuilder(userInputListenerFactory));
recursiveMenuStructureBuilder.setSubtreeDefaultBuilderPair("toolbar", "toolbar.action");
recursiveMenuStructureBuilder.addBuilderPair("toolbar.action", new BuilderDestroyerPair(new JToolbarComponentBuilder(), null));
}
use of org.freeplane.features.mode.FreeplaneActions in project freeplane by freeplane.
the class ActionFinderTest method attachesSetBooleanPropertyAction.
@Test
public void attachesSetBooleanPropertyAction() {
FreeplaneActions freeplaneActions = mock(FreeplaneActions.class);
final SetBooleanPropertyAction setBooleanPropertyAction = Mockito.mock(SetBooleanPropertyAction.class);
Entry entry = new Entry();
final String propertyActionName = "SetBooleanPropertyAction.property";
entry.setName(propertyActionName);
when(freeplaneActions.getAction(propertyActionName)).thenReturn(null);
final ActionFinder actionFinder = new ActionFinder(freeplaneActions) {
@Override
protected AFreeplaneAction createAction(Class<? extends AFreeplaneAction> actionClass, String propertyName) {
return setBooleanPropertyAction;
}
};
actionFinder.visit(entry);
Mockito.verify(freeplaneActions).addAction(setBooleanPropertyAction);
assertThat(new EntryAccessor().getAction(entry), CoreMatchers.<Object>equalTo(setBooleanPropertyAction));
}
use of org.freeplane.features.mode.FreeplaneActions in project freeplane by freeplane.
the class MenuBuildProcessFactoryTest method setup.
@Before
public void setup() {
freeplaneActions = mock(FreeplaneActions.class);
final ResourceAccessor resourceAccessorMock = mock(ResourceAccessor.class);
when(resourceAccessorMock.getRawText(Matchers.anyString())).thenReturn("text");
final IUserInputListenerFactory userInputListenerFactory = mock(IUserInputListenerFactory.class);
final FreeplaneMenuBar menubar = TestMenuBarFactory.createFreeplaneMenuBar();
when(userInputListenerFactory.getMenuBar()).thenReturn(menubar);
phaseProcessor = new MenuBuildProcessFactory(userInputListenerFactory, freeplaneActions, resourceAccessorMock, mock(IAcceleratorMap.class), new EntriesForAction(), Collections.<BuildPhaseListener>emptyList()).getBuildProcessor();
}
Aggregations