可能重复:
以下代码的junit测试类
如何为以下代码编写 junit 测试类,
包装样品;
公共类 Fortest {
UserDao userdao = new UserDao(); Phone name = new Phone(); public String handleUser(User user) { String returncode="failed"; // User usr = new User("bob"); String username=user.getUsername(); String pass=user.getPass(); System.out.println("username and password : "+username+" : "+pass); String ph = name.getA(); System.out.println("ph "+ph); if(ph.equalsIgnoreCase("test")){ System.out.println("A "+ph); returncode="done"; } System.out.println("returning "+returncode); return returncode; // System.out.println("name "+name.toString()); // System.out.println(name.getA()); } }