Search in sources :

Example 11 with FieldDefinition

use of com.cronutils.model.field.definition.FieldDefinition in project cron-utils by jmrozanec.

the class FieldDefinitionTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    testFieldName = CronFieldName.SECOND;
    fieldDefinition = new FieldDefinition(testFieldName, mockConstraints);
}
Also used : FieldDefinition(com.cronutils.model.field.definition.FieldDefinition) Before(org.junit.Before)

Example 12 with FieldDefinition

use of com.cronutils.model.field.definition.FieldDefinition in project cron-utils by jmrozanec.

the class FieldDefinitionTest method testCreateFieldDefinitionComparatorLesser.

@Test
public void testCreateFieldDefinitionComparatorLesser() {
    final CronFieldName name1 = CronFieldName.DAY_OF_MONTH;
    final CronFieldName name2 = CronFieldName.SECOND;
    final FieldDefinition fieldDefinition1 = new FieldDefinition(name1, mockConstraints);
    final FieldDefinition fieldDefinition2 = new FieldDefinition(name2, mock(FieldConstraints.class));
    assertNotEquals(name1.getOrder(), name2.getOrder());
    assertTrue(FieldDefinition.createFieldDefinitionComparator().compare(fieldDefinition2, fieldDefinition1) < 0);
}
Also used : CronFieldName(com.cronutils.model.field.CronFieldName) FieldDefinition(com.cronutils.model.field.definition.FieldDefinition) FieldConstraints(com.cronutils.model.field.constraint.FieldConstraints) Test(org.junit.Test)

Aggregations

FieldDefinition (com.cronutils.model.field.definition.FieldDefinition)12 Test (org.junit.Test)7 FieldConstraints (com.cronutils.model.field.constraint.FieldConstraints)6 CronFieldName (com.cronutils.model.field.CronFieldName)4 DayOfWeekFieldDefinition (com.cronutils.model.field.definition.DayOfWeekFieldDefinition)2 Function (com.cronutils.Function)1 CronField (com.cronutils.model.field.CronField)1 Every (com.cronutils.model.field.expression.Every)1 FieldExpression (com.cronutils.model.field.expression.FieldExpression)1 On (com.cronutils.model.field.expression.On)1 ValidationFieldExpressionVisitor (com.cronutils.model.field.expression.visitor.ValidationFieldExpressionVisitor)1 VisibleForTesting (com.cronutils.utils.VisibleForTesting)1 MessageFormat (java.text.MessageFormat)1 DayOfWeek (java.time.DayOfWeek)1 Month (java.time.Month)1 TextStyle (java.time.format.TextStyle)1 HashSet (java.util.HashSet)1 ResourceBundle (java.util.ResourceBundle)1 Before (org.junit.Before)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1