Question
I can't figure out why I'm getting docked points on this. I am given the following hint: * Hint: health value not null as expected
I can't figure out why I'm getting docked points on this. I am given the following hint:
* Hint: health value not null as expected by default constructor
The first code is the constructor and the second code is my test case. What am I doing wrong when I write the code to test the health value?
/**
* First constructor for objects of class RateEstimator.
*/
public RateEstimator()
{
this.smoker = false;
this.gender = ' ';
this.age = 0;
this.highRisk = false;
this.numTickets = 0;
this.health = "Null";
}
/**
* Test constructor #1.
*/
@Test
public void testConstructor1()
{
RateEstimator rateTest = new RateEstimator();
assertNotNull(rateTest);
// check smoker attribute value
assertFalse(rateTest.isSmoker());
// check gender attribute value
assertEquals(' ', rateTest.getGender());
// check age attribute value
assertEquals(0, rateTest.getAge());
// check high risk attribute value
assertFalse(rateTest.isHighRisk());
// check number of tickets attribute value
assertEquals(0, rateTest.getNumTickets());
// check health attribute value
assertEquals("Null", rateTest.getHealth());
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