Car extends Vehicle { public boolean isRegisteredAfter(Date date) { return registrationDate.compareTo(date) >= 0; } Car(Date registrationDate, int engineSize); boolean isRegisteredAfter(Date date); int getCO2(); @Override VEHICULE_TYPE getType();  }
@Test public void canBeRegisteredBeforeLimitDate() throws ParseException { Date dateBeforeLimitDate = date("01/01/2000"); Date limitDate = date("01/01/2002"); Car car = new Car(dateBeforeLimitDate, 1550); boolean isRegisteredAfter = car.isRegisteredAfter(limitDate); assertFalse(isRegisteredAfter); }
@Test public void canBeRegisteredAfterLimitDate() throws ParseException { Date dateAfterLimitDate = date("01/01/2012"); Date limitDate = date("01/01/2002"); Car car = new Car(dateAfterLimitDate, 1550); boolean isRegisteredAfter = car.isRegisteredAfter(limitDate); assertTrue(isRegisteredAfter); }
@Test public void registrationOnLimitDateIsConsiredredAfter() throws ParseException { Date limitDate = date("01/01/2002"); Car car = new Car(limitDate, 1550); boolean isRegisteredAfter = car.isRegisteredAfter(limitDate); assertTrue(isRegisteredAfter); }