I’m writing integration tests for a project I’m working on and I’m stuck. I have an object (let’s call it travelerDetail) that stores a list of objects that represent seats booked on a flight and I want to create a travelDetail element in xml that has an attribute that reflects these seats. Right now it’s sort of like:
<SEAT DDATE="2012-05-22" TCHG="07:30:10" ROW="11" LETTER="A" POSN="R" SIDE="L" EXIT="N" ID="D164771" CKIN="" ONBORD="" CHGCDE="C" PAGE="1" DCHG="2012-05-22 12:20:44.396" TCHG="16:43:45" PCHG="07272" />
<TRAVELERDETAIL ITN="3224" PDDATE="07:30:10" DOW="4" ORIG="BLI" DEST="LAS" FINALDST="LAS" PTYPE="R" LNAME="SPADE" FNAME="ADULTONE" SFEE1="0.00" SFEE2="0.00" SFEE3="0.00" NOREFUND="" FARE="127.44" COST="0.00" FTAX="9.56" PFC="4.50" FSC="0.00" FEDEX="3.80" SECCHG="2.50" DISCAMT="0.00" ALLOCFARE="127.44" MILES="954" FUELGAL="0.000" FUELRATE="0.000" FUELPRICE="0.00" CNTRY="USA" BOOKTIME="2012-05-22 12:20:44.396" BKCHG="0.00" WAITING="N" TFLT="" BAGS="0" PPBAGS="1" PPFEE="19.99" APBAGS="0" APFEE="0.00" TPFEE="0.00" FREEBAGS="0" DEPART="2012-05-22 12:20:44.396" ARRIVE="2012-05-22 12:20:44.396" GENDER="M" DOB="1970-01-01" DHSSEQ="0" CHGCDE="A" PAGE="0" DCHG="2012-05-22" TCHG="07:30:10" REC_ID="-10"/>
The TravelerDetail class maintains a list of Seats that the traveler might have booked on the flight. Can I create xml test data like this?
IMHO XML attribute can be a property of any object…not an object by itself
This is probably how you want your xml to look like.
Of course you can have any number of seats assigned to your TRAVELERDETAIL as it is identified by Itinerary