You need to sign in to do that
Don't have an account?
Help me to write test class for XMLStreamwriter.
Hi All, Help me to write a test class for below code,
public void storeProducts(){
XmlStreamWriter w = new XmlStreamWriter();
w.writeStartElement(null, 'Product', null);
w.writeStartElement(null, 'Id', null);
w.writeCharacters(p.Id);
w.writeEndElement();
...............
..................
............................
}
Test class: I have written test class as,
static TestMethod void storeProducts (){
XmlstreamWriter demo = new XmlstreamWriter();
string result=demo.getXmlstring();
string expected='<?xml version="1.0"?><?Products?>' + '<m:Product>' + '<00190000009rvgY>'; // is any other way to represent this line//
System.assert(result == expected);
}
Failure: System.AssertException: Assertion Failed.
Thanks in Advance.
Hi,
This is a duplicate post please make sure that you do not post any duplication questions on discussion board. So I request you to please remove it. For information regarding this post you can go to the following link:
http://boards.developerforce.com/t5/New-to-Cloud-Development/Help-me-to-write-test-class-for-XMLStreamwriter/m-p/424389#M4255
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.