JayJay Simpson
JayJay Simpson

Reputation: 155

How to create a stub?

I am trying to create a stub of Customer which from my knowledge is a fake class as myCustomer cannot be resolved to this. However, I have checked everywhere online on any basic tutorial or examples to create a stub but cannot find it anywhere.

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;
    }
}

Upvotes: 0

Views: 7008

Answers (1)

OldCurmudgeon
OldCurmudgeon

Reputation: 65813

My IDE (NetBeans) automatically created a stubbed Customer like this:

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

Upvotes: 1

Related Questions