@Test public void testCreateFieldDefinitionComparatorEqual() throws Exception { CronFieldName name = CronFieldName.DAY_OF_MONTH; FieldDefinition fieldDefinition1 = new FieldDefinition(name, mockConstraints); FieldDefinition fieldDefinition2 = new FieldDefinition(name, mock(FieldConstraints.class)); assertEquals(name.getOrder(), name.getOrder()); assertEquals( 0, FieldDefinition.createFieldDefinitionComparator() .compare(fieldDefinition1, fieldDefinition2)); }
@Test public void testCreateFieldDefinitionComparatorLesser() throws Exception { CronFieldName name1 = CronFieldName.DAY_OF_MONTH; CronFieldName name2 = CronFieldName.SECOND; FieldDefinition fieldDefinition1 = new FieldDefinition(name1, mockConstraints); FieldDefinition fieldDefinition2 = new FieldDefinition(name2, mock(FieldConstraints.class)); assertNotEquals(name1.getOrder(), name2.getOrder()); assertTrue( FieldDefinition.createFieldDefinitionComparator() .compare(fieldDefinition2, fieldDefinition1) < 0); }
@Test public void testCreateFieldDefinitionComparatorNotNull() throws Exception { assertNotNull(FieldDefinition.createFieldDefinitionComparator()); }