### Question:
MenuFactory { public List<Menu> create(final List<ApplicationMenu> menuList) throws ApplicationPageNotFoundException, SearchException { return collect(menuList, new RootMenuCollector()); } MenuFactory(final ApplicationAPI applicationApi); List<Menu> create(final List<ApplicationMenu> menuList);  }### Answer:
@Test public void should_create_a_MenuLink_with_the_page_token_it_is_pointing_at_when_menu_is_a_link() throws Exception { MenuFactory factory = new MenuFactory(applicationApi); assertThat(factory.create(asList((ApplicationMenu) aMenuLink)).get(0).getHtml()) .isEqualTo("<li><a href=\"token\">link</a></li>"); }
@Test public void should_create_an_empty_MenuContainer() throws Exception { MenuFactory factory = new MenuFactory(applicationApi); assertThat(factory.create(asList((ApplicationMenu) aMenuContainer)).get(0).getHtml()) .isEqualTo(new StringBuilder() .append("<li class=\"dropdown\"><a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">container <span class=\"caret\"></span></a>") .append("<ul class=\"dropdown-menu\" role=\"menu\">") .append("</ul></li>").toString()); }
@Test public void should_create_a_MenuContainer_containing_a_MenuLink() throws Exception { MenuFactory factory = new MenuFactory(applicationApi); assertThat(factory.create(asList((ApplicationMenu) aMenuContainer, aNestedMenuLink)).get(0).getHtml()) .isEqualTo(new StringBuilder() .append("<li class=\"dropdown\"><a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">container <span class=\"caret\"></span></a>") .append("<ul class=\"dropdown-menu\" role=\"menu\">") .append("<li><a href=\"token\">nested-link</a></li>") .append("</ul></li>").toString()); }