You need to sign in to do that
Don't have an account?
jhansisridhar_2011
Test coverage to satisfy if condtion
How to get satisfy the if condition so which not able to cover
XmlStreamReader r = new XmlStreamReader(xmlInput);
if ('Product' == r.getLocalName()) {
.
.
.
}
Thanks in Advance.
You just create a string and call your function:
String xmlInput= '<Product>Foo bar</Product>' ;
function(xmlInput);
Does that help?
Hi Roy,
I tried ur method, thrown an error
Error: Compile Error: Method does not exist or incorrect signature: function(String) at line 54 column .
The point wasn't to just copy paste the line.
Assuming the code you are testing is in a method, its getting that xmlinput string from somewhere, if not, handle it in a method that accepts a parameter, so you can submit test data into it.
So if you'd have:
you could test doing: