Skip to content

Commit

Permalink
Update Spring definition.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmrozanec committed Nov 21, 2020
1 parent 4cf373f commit d9b957c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@
<!-- https://stackoverflow.com/questions/24386771/javax-validation-validationexception-hv000183-unable-to-load-javax-el-express -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ private static CronDefinition spring() {
.withHours().withValidRange(0, 23).withStrictRange().and()
.withDayOfMonth().withValidRange(1, 31).supportsQuestionMark().and()
.withMonth().withValidRange(1, 12).and()
.withDayOfWeek().withValidRange(0, 7).withMondayDoWValue(1).withIntMapping(7,0).supportsQuestionMark().and()
.withDayOfWeek().withValidRange(0, 7).withMondayDoWValue(1).withIntMapping(7,0)
.supportsHash().supportsQuestionMark().and()
.instance();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.cronutils.parser;

import com.cronutils.model.CronType;
import com.cronutils.model.definition.CronDefinitionBuilder;
import org.junit.Before;
import org.junit.Test;
import org.springframework.scheduling.support.CronExpression;

public class CronParserSpringIntegrationTest {
private CronParser parser;
@Before
public void setUp() {
parser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.SPRING));
}

@Test
public void testSpringCronSupportNthDayOfWeek(){
CronExpression.parse("0 0 0 ? * WED#2");
parser.parse("0 0 0 ? * WED#2");
}

}

0 comments on commit d9b957c

Please sign in to comment.