如何创建存根?

时间:2015-12-03 15:41:55

标签: java stub

我正在尝试创建Customer的存根,据我所知,这是一个假类,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;
    }
}

1 个答案:

答案 0 :(得分:1)

我的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() {
    }
}