Answered step by step
Verified Expert Solution
Question
1 Approved Answer
X 1 2 6 8 : Write JUnit test case for accessor method Use this partial definition of a Student class to solve this exercise.
X: 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 StudentString name, int birthYear
returns the name of the student
String getName
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 B Gates", ;
Student firstCoder new StudentA Lovelce;
Student hiddenEngineer new Student K Johnson", ;
Write a JUnit test case that checks that ie asserts the futureCE was born in In other words, it asserts that birth yea access the futureCEO instance, and call the getBirthYear
Your Answer:
Feedback
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started