Question: open X 1 2 6 9 : Write JUnit test case for accessor method - 2 2 5 % Use this partial definition of a
open X: Write JUnit test case for accessor method
Use this partial definition of a Student class to solve this exercise.
public class Student
i
create a new student with name and birth year
public Student String name, int birthYear
returns the name of the student
String getwame
I stores the name of the student
void setNameString name
sets the birth year of the student
boolean setBirthYearint 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.
Student futureCEO new Student;
Student firstCoder new Student;
Student hiddenEngineer new Student;
Write a JUnit test case that checks that the first coder was born earlier than the hidden engineer ie the birth year for "A Lovelace is less thar year for K Johnson"
Your Answer:
Feedback
void testiwo
i
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
