Using an appropriate package and test class name, write the following tests for GamerProfile's constructor: testNameShouldNotBeNull testNameShouldNotBeEmpty testNameShouldNotBeBlank testShouldCreateValidGamerProfile Hint: use assertTrue or assertFalse for getters involving boolean values
- Using an appropriate package and test class name, write the following tests for GamerProfile's constructor:
- testNameShouldNotBeNull
- testNameShouldNotBeEmpty
- testNameShouldNotBeBlank
- testShouldCreateValidGamerProfile
- Hint: use assertTrue or assertFalse for getters involving boolean values
Hint: get the game list from the gamer and call the list's isEmpty along with an assertTrue or assertFalse, as appropriate.
GamerProfile:
public class GamerProfile {
private String userName;
private boolean pvpEnabled;
private boolean online;
private ArrayList<GameInfo> gameLibrary;
public GamerProfile(String userName) {
this.userName = userName;
this.pvpEnabled = false;
this.online = false;
gameLibrary = new ArrayList<GameInfo>();
}
// Getter for the getUserName variable
public String getUserName() {
return userName;
}
// Getter for the PvpEnabled variable
public boolean isPvpEnabled() {
return pvpEnabled;
}
// Getter for the online variable
public boolean isOnline() {
return online;
}
public ArrayList<GameInfo> getGameLibrary() {
return gameLibrary;
}
// Setter for the PvpEnabled variable
public void setPvpEnabled(boolean pvpEnabled) {
this.pvpEnabled = pvpEnabled;
}
// Getter for the online variable
public void setOnline(boolean online) {
this.online = online;
}
}

Trending now
This is a popular solution!
Step by step
Solved in 3 steps









