### Question:
CopyWikiTableActionFactory implements ICopyWikiTableActionFactory { @Override public JMenuItem createMenueItem(ITableActionCallback callback){ @SuppressWarnings("unchecked") Collection<IWikiTableConfiguration> configurations = CollectionUtils.select(configurationFactory.getConfigurations(), new EnabledConfigurationPredicate()); if(configurations.isEmpty()){ return createMenuForEmptyConfigurations(); }else if(configurations.size() == 1){ return createMenuForExactlyOneConfiguration(callback, configurations.iterator().next()); }else{ return createMenuForAListOfConfiguration(callback, configurations); } } CopyWikiTableActionFactory(); @Override JMenuItem createMenueItem(ITableActionCallback callback); static synchronized ICopyWikiTableActionFactory getInstance(); IWikiTableConfigurationFactory getConfigurationFactory(); void setConfigurationFactory(IWikiTableConfigurationFactory configurationFactory);  }### Answer:
@Test public void testCreateMenueItem() { mockHelper.resetAll(); IWikiTableConfigurationFactory mockWikiConfigFactory = mockHelper.createMock(IWikiTableConfigurationFactory.class); IWikiTableConfiguration mockConfigA = mockHelper.createMock(IWikiTableConfiguration.class); expect(mockConfigA.getName()).andStubReturn("MockConfigA"); expect(mockConfigA.isEnabled()).andStubReturn(true); IWikiTableConfiguration mockConfigB = mockHelper.createMock(IWikiTableConfiguration.class); expect(mockConfigB.getName()).andStubReturn("MockConfigB"); expect(mockConfigB.isEnabled()).andStubReturn(true); List<IWikiTableConfiguration> configList = new ArrayList<IWikiTableConfiguration>(); configList.add(mockConfigA); configList.add(mockConfigB); expect(mockWikiConfigFactory.getConfigurations()).andReturn(configList); classUnderTest.setConfigurationFactory(mockWikiConfigFactory); mockHelper.replayAll(); JMenuItem menuItem = classUnderTest.createMenueItem(mockCallback); assertNotNull(menuItem); assertEquals(JMenu.class, menuItem.getClass()); JMenu menu = (JMenu) menuItem; assertEquals(2, menu.getItemCount()); }