You need to sign in to do that
Don't have an account?
AkiT
Quick shoot:
How would you write unit tests for such a code?
How to write tests for xmlStreamWriter
Code:
global class XmlWriterCamos { WebService static String getXmlStream(Id[] versId) { //INITIATE XML STREAM XmlStreamWriter w = new XmlStreamWriter(); //INPUT START ELEMENT w.writeStartElement(null, 'Data', null); //INPUT CurrentUser INFO w.writeStartElement(null, 'CurrentUser', null); w.writeStartElement(null, 'ID', null); w.writeCharacters(u[0].Id); w.writeEndElement(); //end Id if(u[0].City != null){ w.writeStartElement(null, 'City', null); w.writeCharacters(u[0].City); w.writeEndElement(); //end City } ...
Quick shoot:
How would you write unit tests for such a code?
jlo
Pseudo-code:
lopezc
Hi,
Thanks for you code! it helped me a lot. But I have a small question about the return param in the first piece of code.. if you have a XmlStreamWriter object, how do you return a String? I tried with w.toString() but it is not working.. any help?
Thanks!
AkiT
XmlStreamWriter class has its own methods.
Code: