### Question:
BasicRiskRatio extends BasicRatio { @Override public boolean isDefined() { return super.isDefined() && d_baseline.getRate() > 0 && d_subject.getRate() > 0; } BasicRiskRatio(RateMeasurement baseline, RateMeasurement subject); @Override String toString(); @Override Double getError(); String getName(); @Override boolean isDefined(); RelativeEffect<RateMeasurement> getCorrected();  }### Answer:
@Test public void testZeroBaselineRateShouldBeUndefined() { RateMeasurement base = new BasicRateMeasurement(0, 100); RateMeasurement subj = new BasicRateMeasurement(50, 100); BasicRiskRatio or = new BasicRiskRatio(base, subj); assertFalse(or.isDefined()); }
@Test public void testFullSubjectRateShouldBeDefined() { RateMeasurement base = new BasicRateMeasurement(50, 100); RateMeasurement subj = new BasicRateMeasurement(100, 100); BasicRiskRatio or = new BasicRiskRatio(base, subj); assertTrue(or.isDefined()); }
@Test public void testZeroSubjectRateShouldBeUndefined() { RateMeasurement base = new BasicRateMeasurement(50, 100); RateMeasurement subj = new BasicRateMeasurement(0, 100); BasicRiskRatio or = new BasicRiskRatio(base, subj); assertFalse(or.isDefined()); }
@Test public void testFullBaselineRateShouldBeDefined() { RateMeasurement base = new BasicRateMeasurement(100, 100); RateMeasurement subj = new BasicRateMeasurement(50, 100); BasicRiskRatio or = new BasicRiskRatio(base, subj); assertTrue(or.isDefined()); }