Question: X 1 2 6 8 : Write JUnit test case for accessor method Use this partial definition of a Student class to solve this exercise.

X1268: Write JUnit test case for accessor method
Use this partial definition of a Student class to solve this exercise.
public class student
q
II create a new student with name and birth year
public Student(String name, int birthYear)
// returns the name of the student
String getName()
I/ stores the name of the student
void setName(String name)
// sets the birth year of the student
boolean setBirthYear(int year) I
// returns the birth year of the student
int getBirthYear()
// returns the student's age by subtracting today
// age from the birth year
}
int getAge()
And consider these lines of code that create three instances of Student objects.
1 Student futureCEO = new Student ("B Gates", 1955);
Student firstCoder = new Student("A Lovelce",1815);
Student hiddenEngineer = new Student ("K Johnson", 1918);
Write a JUnit test case that checks that (i.e., asserts) the futureCE0 was born in 1955. In other words, it asserts that birth yea access the futureCEO instance, and call the getBirthYear().
Your Answer:
Feedback
 X1268: Write JUnit test case for accessor method Use this partial

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!