how to write unit test for static methods
0 posts in topic
Flat View  Flat View

Posted By:   sudhakar_vasiraju
Posted On:   Monday, March 2, 2009 02:37 PM

I have a method as follows for which i want to write unit test


public static String makeXML(){
List data = getData();
for (int i=0; i < data.size(); i++){
generate xml from the list
protected static getData(){
connect to database and get data

While writing unit test for this method I am not able to override getData() method as it is static. Is there any way to override it? I am not able to make makeXML() non-static.

About | Sitemap | Contact