/**
  * 服务员传过来一个新的菜单,需要同步 因为同时会有很多的服务员传入菜单,而同时又有很多厨师在从队列里取值
  *
  * @param menu 传入的菜单
  */
 public static synchronized void addMenu(MenuCommand menu) {
   // 一个菜单对象包含很多命令对象
   for (Command cmd : menu.getCommands()) {
     cmds.add(cmd);
   }
 }
 @Test
 public void shouldInstructLibraryToCheckOutBookWhenBookSpecified() throws IOException {
   when(bufferedReader.readLine()).thenReturn("Harry Potter");
   menuCommand.checkOutBook();
   verify(library).checkOut("Harry Potter");
 }
 @Test
 public void shouldInstructLibraryToReturnBooksWhenBookReturnIsSelected() throws IOException {
   when(bufferedReader.readLine()).thenReturn("Harry Potter");
   menuCommand.returnBook();
   verify(library).returnBook("Harry Potter");
 }
 @Test
 public void shouldInstructLibraryToListBooksWhenListBooksChosen() {
   menuCommand.listBooks();
   verify(library).listBooks();
 }