While running the public tests for my code I have received 2 errors on similar lines. The errors are:
Null Pointer Exception Errors and the line in which they appear is the one with getCurrentLocation & getName in it.
assertEquals("Initially, Parrade is at Fun Fire", "Fun Fire", parrade.getCurrentLocation().getName());
parrade.move();
The full code of my constructors as well as getCurrentLocation & getName are as follows:
Code:
public abstract class Ride {
private String name;
private int duration;
private int batchSize;
private ArrayList<Amuser> currentAmusers;
private int ridesToMaintain;
private FunRide location;
public Ride() {
this.name = "Serpent";
this.duration = 5;
this.batchSize = 20;
this.ridesToMaintain = 10;
this.currentAmusers = new ArrayList<Amuser>();
}
public Ride(String name, int duration, int batchSize) {
this.name = name;
this.duration = duration;
this.batchSize = batchSize;
this.ridesToMaintain = 10;
this.currentAmusers = new ArrayList<Amuser>();
}
public FunRide getCurrentLocation() {
return this.location;
}
Any idea how to solve this?