package com.cron.utils.model;

import com.cron.utils.CronFieldName;
import com.cron.utils.parser.field.FieldConstraints;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import static org.junit.Assert.assertEquals;

public class FieldDefinitionTest {

    private CronFieldName testFieldName;
    @Mock
    private FieldConstraints mockConstraints;

    private FieldDefinition fieldDefinition;

    @Before
    public void setUp() throws Exception {
        MockitoAnnotations.initMocks(this);
        testFieldName = CronFieldName.SECOND;
        fieldDefinition = new FieldDefinition(testFieldName, mockConstraints);
    }

    @Test(expected = NullPointerException.class)
    public void testConstructorNullFieldName(){
        new FieldDefinition(null, mockConstraints);
    }

    @Test(expected = NullPointerException.class)
    public void testConstructorNullConstraints(){
        new FieldDefinition(testFieldName, null);
    }

    @Test
    public void testGetFieldName() throws Exception {
        assertEquals(testFieldName, fieldDefinition.getFieldName());
    }

    @Test
    public void testGetConstraints() throws Exception {
        assertEquals(mockConstraints, fieldDefinition.getConstraints());
    }
}
@@ -258,28 +258,57 @@
 .Assert.
-assertEquals
+*;%0Aimport static org.mockito.Mockito.mock
 ;%0A%0Apubli
@@ -1223,32 +1223,32 @@
 ows Exception %7B%0A
-
         assertEq
@@ -1309,10 +1309,1847 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void testCreateFieldDefinitionComparatorNotNull() throws Exception %7B%0A        assertNotNull(FieldDefinition.createFieldDefinitionComparator());%0A    %7D%0A%0A    @Test%0A    public void testCreateFieldDefinitionComparatorEqual() throws Exception %7B%0A        CronFieldName name = CronFieldName.DAY_OF_MONTH;%0A        FieldDefinition fieldDefinition1 = new FieldDefinition(name, mockConstraints);%0A        FieldDefinition fieldDefinition2 = new FieldDefinition(name, mock(FieldConstraints.class));%0A        assertEquals(name.getOrder(), name.getOrder());%0A        assertEquals(0, FieldDefinition.createFieldDefinitionComparator().compare(fieldDefinition1, fieldDefinition2));%0A    %7D%0A%0A    @Test%0A    public void testCreateFieldDefinitionComparatorGreater() throws Exception %7B%0A        CronFieldName name1 = CronFieldName.DAY_OF_MONTH;%0A        CronFieldName name2 = CronFieldName.SECOND;%0A        FieldDefinition fieldDefinition1 = new FieldDefinition(name1, mockConstraints);%0A        FieldDefinition fieldDefinition2 = new FieldDefinition(name2, mock(FieldConstraints.class));%0A        assertNotEquals(name1.getOrder(), name2.getOrder());%0A        assertTrue(FieldDefinition.createFieldDefinitionComparator().compare(fieldDefinition1, fieldDefinition2) %3E 0);%0A    %7D%0A%0A    @Test%0A    public void testCreateFieldDefinitionComparatorLesser() throws Exception %7B%0A        CronFieldName name1 = CronFieldName.DAY_OF_MONTH;%0A        CronFieldName name2 = CronFieldName.SECOND;%0A        FieldDefinition fieldDefinition1 = new FieldDefinition(name1, mockConstraints);%0A        FieldDefinition fieldDefinition2 = new FieldDefinition(name2, mock(FieldConstraints.class));%0A        assertNotEquals(name1.getOrder(), name2.getOrder());%0A        assertTrue(FieldDefinition.createFieldDefinitionComparator().compare(fieldDefinition2, fieldDefinition1) %3C 0);%0A    %7D
 %0A%7D

Add tests for FieldDefinition comparator