Skip to content
Advertisement

How make a JUnit test that checks whether a date you entered is invalid or not

I am trying to make a JUnit test that checks whether the inputs for an Appointment object are valid or not. I have finished making all the tests, but whenever I run the test, all of the tests pass except for one. For some reason the test testDateInThePast() is failing. Can someone point out the problem? Here is my code:

Appointment.java

JavaScript

AppointmentTest.java

JavaScript

Advertisement

Answer

Consider moving to new java.time.LocalDate

JavaScript

and:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement