public class RESTMenuServiceTest extends RESTAbstractTest {
//test happy path for RESTMenuService.listMenuItems()
public void testListMenuItemsOK() throws Exception {
RESTMenuService restService = new RESTMenuService();
MenuService menuService = EasyMock.createMock(MenuService.class);
Map<String, List<MenuItemDescription>> retval = new HashMap<String, List<MenuItemDescription>>();
List<MenuItemDescription> menuList = new ArrayList<MenuItemDescription>();
MenuItemDescription menuItem1 = new MenuItemDescription();
List<String> allowedEvents = new ArrayList<String>();
allowedEvents.add("onclick");
allowedEvents.add("onblur");
allowedEvents.add("onfocus");
List<FormEffectDescription> effects = new ArrayList<FormEffectDescription>();
FormEffectDescription effect1 = new FormEffectDescription();
effect1.setClassName("org.jbpm.formbuilder.client.effect.ResizeEffect");
effects.add(effect1);
FormEffectDescription effect2 = new FormEffectDescription();
effect2.setClassName("org.jbpm.formbuilder.client.effect.RemoveEffect");
effects.add(effect2);
menuItem1.setAllowedEvents(allowedEvents);
menuItem1.setClassName("org.jbpm.formbuilder.client.menu.items.ClientScriptMenuItem");
menuItem1.setEffects(effects);
MenuItemDescription menuItem2 = new MenuItemDescription();
menuItem2.setClassName("org.jbpm.formbuilder.client.menu.items.TableLayoutMenuItem");
menuItem2.setAllowedEvents(allowedEvents);
menuList.add(menuItem1);
menuList.add(menuItem2);
retval.put("group", menuList);
EasyMock.expect(menuService.listMenuItems()).andReturn(retval).once();
restService.setMenuService(menuService);
EasyMock.replay(menuService);
Response resp = restService.listMenuItems();
EasyMock.verify(menuService);