如何创建存根?
How to create a stub?
我正在尝试创建一个 Customer
的存根,据我所知这是一个假的 class,因为 myCustomer
无法解决这个问题。但是,我已经在网上到处查看任何基本教程或示例以创建存根,但找不到任何地方。
import java.util.*;
public class Bank {
public int bankAccount(int customerNumber, int startingBalance){
Scanner stdin = new Scanner(System.in);
System.out.println("Welcome Everyone.");
Customer myCustomer = Customer.getWithCustomerNumber(customerNumber);
String name = myCustomer.name;
}
}
我的 IDE (NetBeans) 自动创建了一个存根 Customer
,如下所示:
private static class Customer {
private String name;
private static Customer getWithCustomerNumber(int customerNumber) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
public Customer() {
}
}
我正在尝试创建一个 Customer
的存根,据我所知这是一个假的 class,因为 myCustomer
无法解决这个问题。但是,我已经在网上到处查看任何基本教程或示例以创建存根,但找不到任何地方。
import java.util.*;
public class Bank {
public int bankAccount(int customerNumber, int startingBalance){
Scanner stdin = new Scanner(System.in);
System.out.println("Welcome Everyone.");
Customer myCustomer = Customer.getWithCustomerNumber(customerNumber);
String name = myCustomer.name;
}
}
我的 IDE (NetBeans) 自动创建了一个存根 Customer
,如下所示:
private static class Customer {
private String name;
private static Customer getWithCustomerNumber(int customerNumber) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
public Customer() {
}
}