-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
101 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/test/java/com/cronutils/utils/descriptor/CronDescriptorCron4jIntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.cronutils.utils.descriptor; | ||
|
||
import com.cronutils.descriptor.CronDescriptor; | ||
import com.cronutils.model.CronType; | ||
import com.cronutils.model.definition.CronDefinitionBuilder; | ||
import com.cronutils.parser.CronParser; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import java.util.Locale; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class CronDescriptorCron4jIntegrationTest { | ||
private CronDescriptor descriptor; | ||
private CronParser parser; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
descriptor = CronDescriptor.instance(Locale.UK); | ||
parser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.CRON4J)); | ||
} | ||
|
||
@Test | ||
public void testEveryMinuteBetween1100And1110(){ | ||
assertEquals("every minute between 11:00 and 11:10", descriptor.describe(parser.parse("0-10 11 * * *"))); | ||
} | ||
|
||
@Test | ||
public void testEveryMinute(){ | ||
assertEquals("every minute", descriptor.describe(parser.parse("* * * * *"))); | ||
assertEquals("every minute", descriptor.describe(parser.parse("*/1 * * * *"))); | ||
assertEquals("every minute", descriptor.describe(parser.parse("0/1 * * * ?"))); | ||
} | ||
|
||
@Test | ||
public void testEveryFiveMinutes(){ | ||
assertEquals("every 5 minutes", descriptor.describe(parser.parse("*/5 * * * *"))); | ||
assertEquals("every 5 minutes", descriptor.describe(parser.parse("0/5 * * * ?"))); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters