@Test public void buildingInZone() throws JAXBException { String xml = "<zone x=\"14\" y=\"15\" nvt=\"0\" danger=\"3\">" + "<building name=\"Disused Car Park\" type=\"14\" dig=\"0\">An almost completely buried underground parking lot. An ideal venue to 'go quietly into the night' as long as nobody hears you...</building>" + "</zone>"; Zone zone = (Zone) XmlToObjectConverter.convertXmlToObject(xml, Zone.class); assertNotNull("Expected a building to be inside the zone", zone.getBuilding()); assertEquals(14, zone.getBuilding().getType()); assertEquals(0, zone.getBuilding().getDig()); }
@Test public void unmarshallXmlSnippet() throws JAXBException { String xml = "<zone x=\"21\" y=\"12\" nvt=\"1\" tag=\"5\" danger=\"1\"/>"; Zone zone = (Zone) XmlToObjectConverter.convertXmlToObject(xml, Zone.class); assertEquals(21, zone.getX()); assertEquals(12, zone.getY()); assertEquals(true, zone.getDiscoveredNotVisitedToday()); assertEquals(ZoneTag.DEPLETED, zone.getTag()); assertEquals(-1, zone.getZombies()); assertEquals(ZoneDanger.ONE_TO_THREE, zone.getDanger()); }
@Test public void zoneInRangeButNoUpdatedMapAvailable() throws JAXBException { String xml = "<zone x=\"14\" y=\"12\" nvt=\"0\" danger=\"2\"/>"; Zone zone = (Zone) XmlToObjectConverter.convertXmlToObject(xml, Zone.class); assertEquals(-1, zone.getZombies()); }
@Test public void hereBeZombies() throws JAXBException { String xml = "<zone x=\"21\" y=\"12\" z=\"7\" nvt=\"1\" tag=\"5\" danger=\"1\"/>"; Zone zone = (Zone) XmlToObjectConverter.convertXmlToObject(xml, Zone.class); assertEquals(7, zone.getZombies()); }