private <E extends RuntimeException> void assertRunnable(Runnable test, Class<E> type) { assertNotNull(test); try { test.run(); fail(); } catch (RuntimeException e) { assertException(type, e, "runnable"); } }
/** * Steps tested: * * <p>select -> run (if not null) -> invokeBehavior(method) -> test selection/focus state * * @param method the name of the method do invoke in behaviour * @param selectedIndex the index to select * @param expectedIndex the expected index after running and invoking * @param run the action to run after selecting, may be null to do nothing * @throws Exception */ protected void assertBehaviorSelectionMovedWithModification( String method, int selectedIndex, int expectedIndex, Runnable run) throws Exception { initSkin(); getSelectionModel().select(selectedIndex); if (run != null) run.run(); invokeBehavior(method); assertEquals(method + " selected index must be moved", expectedIndex, getSelectedIndex()); assertEquals(method + " focus must same as selected index", expectedIndex, getFocusedIndex()); assertEquals(method + " selection size must be one", 1, getSelectedIndices().size()); assertEquals(method + " anchor must be same as focus", expectedIndex, getAnchorIndex()); }
@Override public void execute(final Runnable command) { command.run(); }
public void generate(Project project) throws IOException { generator.run(); }