我是 Junit 测试用例世界的新手,我只是想知道我是否开发了一个程序
class MapDemo1
{static final Logger logger = Logger.getLogger(MapDemo1.class);
/**
*
*/
public static void main(String arg[])
{PropertyConfigurator.configure("src/log4j.properties");
logger.info("-->Map");
// Map map=new TreeMap();
Map map=new HashMap();//HashMap key random order.
// System.out.println("Amit".hashCode());
map.put("Amit","Java");
map.put("Amit","Javas");
// map.put("mAit","J2EE");
//map.put("Saral","J2rrrEE");
/*map.put("ty","Spring");
map.put("Anupam","Hibernate");
map.put("Ravi",".Net");
map.put("Saral","Andriod");//same key but different value
map.put("Nitin","PHP");
map.put("hj","Spring1");*/
System.out.println("There are "+map.size()+" elements in the map.");
System.out.println("Content of Map are...");
Set s=map.entrySet();
Iterator itr=s.iterator();
while(itr.hasNext())
{
Map.Entry m=(Map.Entry)itr.next();
System.out.println(m.getKey()+"\t"+m.getValue()+"\t"+ m.hashCode());
}
]
}
现在请告知什么是 junit 测试用例,以及它们将如何在单独的类中编写。