package com.springapp.batch;

import com.springapp.batch.bo.Person;
import org.joda.time.DateTime;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class CompareEntryTest {

    public static final String BILL_DOB = "1970-01-08T12:30:49+05:30";
    public static final String PAUL_DOB = "1970-01-09T15:30:49+05:30";

    /**
     * This test implements Task 3 of the assignment
     * If this fails we don't get the job
     *
     * @throws Exception
     */
    @Test
    public void testAssignmentTask() throws Exception {
        Person bill = mock(Person.class);
        Person paul = mock(Person.class);

        when(bill.getDateOfBirth()).thenReturn(DateTime.parse(BILL_DOB));
        when(paul.getDateOfBirth()).thenReturn(DateTime.parse(PAUL_DOB));

        Assert.assertEquals(1, bill.compareTo(paul));
    }

}

@@ -221,16 +221,53 @@
 unner;%0A%0A
+import static org.junit.Assert.fail;%0A
 import s
@@ -1054,10 +1054,398 @@
 %0A    %7D%0A%0A
+    @Test%0A    public void testPersonWithInvalidDate() throws Exception %7B%0A        Person bill = mock(Person.class);%0A        Person invalidPerson = null;%0A%0A        when(bill.getDateOfBirth()).thenReturn(DateTime.parse(BILL_DOB));%0A%0A        try %7B%0A            bill.compareTo(invalidPerson);%0A            fail(%22Exception should have been thrown%22);%0A        %7D catch (Exception e) %7B%0A        %7D%0A    %7D%0A
 %7D%0A

Add new test to see if we are failing correctly