### Question:
PizzaParser { public List<PizzaOrder> order(InputStream xml) { PizzaContentHandler handler = new PizzaContentHandler(); try { XMLReader parser = XMLReaderFactory.createXMLReader(); parser.setContentHandler(handler); InputSource source = new InputSource(xml); parser.parse(source); return handler.getPizzaOrder(); } catch (Exception ex) { throw new RuntimeException("Exception parsing xml message. Message: " + ex.getMessage(), ex); } }  List<PizzaOrder> order(InputStream xml);  }### Answer:
@Test public void readOrderFromXML() { List<PizzaOrder> results = instance.order(new ByteArrayInputStream(ORDER_XML.getBytes())); assertEquals(1, results.size()); PizzaOrder result = results.get(0); assertEquals("Capricciosa", result.getPizzaName()); assertEquals("thin", result.getBase()); assertEquals("2", result.getQuantity()); }
@Test public void readOrderFromModifiedXML() { List<PizzaOrder> results = instance.order(new ByteArrayInputStream(ORDER_XML_2.getBytes())); assertEquals(1, results.size()); PizzaOrder result = results.get(0); assertEquals("Capricciosa", result.getPizzaName()); assertEquals("thin", result.getBase()); assertEquals("2", result.getQuantity()); }
@Test public void readOrderForMultiplePizza() { List<PizzaOrder> results = instance.order(new ByteArrayInputStream(ORDER_XML_3.getBytes())); PizzaOrder result = results.get(0); assertEquals("Capricciosa", result.getPizzaName()); assertEquals("thin", result.getBase()); assertEquals("2", result.getQuantity()); result = results.get(1); assertEquals("Margherita", result.getPizzaName()); assertEquals("thin", result.getBase()); assertEquals("1", result.getQuantity()); }