forked from jqwik-team/jqwik
-
Notifications
You must be signed in to change notification settings - Fork 0
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
3 changed files
with
59 additions
and
0 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
36 changes: 36 additions & 0 deletions
36
time/src/test/java/net/jqwik/time/api/dateTimes/zonedDateTime/ShrinkingTests.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,36 @@ | ||
package net.jqwik.time.api.dateTimes.zonedDateTime; | ||
|
||
import java.time.*; | ||
import java.util.*; | ||
|
||
import net.jqwik.api.*; | ||
import net.jqwik.testing.*; | ||
import net.jqwik.time.api.*; | ||
import net.jqwik.time.api.arbitraries.*; | ||
|
||
import static java.time.Month.*; | ||
import static org.assertj.core.api.Assertions.*; | ||
|
||
import static net.jqwik.testing.ShrinkingSupport.*; | ||
|
||
public class ShrinkingTests { | ||
|
||
@Property | ||
void defaultShrinking(@ForAll Random random) { | ||
ZonedDateTimeArbitrary dateTimes = DateTimes.zonedDateTime(); | ||
ZonedDateTime value = falsifyThenShrink(dateTimes, random); | ||
assertThat(value).isEqualTo(ZonedDateTime.of(LocalDateTime.of(1900, JANUARY, 1, 0, 0, 0), ZoneId.of("Asia/Aden"))); | ||
} | ||
|
||
@Property(tries = 40) | ||
@Disabled("Not working at the moment") | ||
//TODO | ||
void shrinksToSmallestFailingValue(@ForAll Random random) { | ||
ZonedDateTimeArbitrary dateTimes = DateTimes.zonedDateTime(); | ||
TestingFalsifier<ZonedDateTime> falsifier = | ||
dateTime -> dateTime.isBefore(ZonedDateTime.of(LocalDateTime.of(2013, MAY, 25, 13, 12, 55), ZoneId.of("Indian/Reunion"))); | ||
ZonedDateTime value = falsifyThenShrink(dateTimes, random, falsifier); | ||
assertThat(value).isEqualTo(ZonedDateTime.of(LocalDateTime.of(2013, MAY, 25, 13, 12, 55), ZoneId.of("Asia/Aden"))); | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
time/src/test/java/net/jqwik/time/api/dateTimes/zonedDateTime/SimpleArbitrariesTests.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,22 @@ | ||
package net.jqwik.time.api.dateTimes.zonedDateTime; | ||
|
||
import java.time.*; | ||
|
||
import net.jqwik.api.*; | ||
import net.jqwik.time.api.*; | ||
|
||
import static org.assertj.core.api.Assertions.*; | ||
|
||
public class SimpleArbitrariesTests { | ||
|
||
@Provide | ||
Arbitrary<ZonedDateTime> zonedDateTimes() { | ||
return DateTimes.zonedDateTime(); | ||
} | ||
|
||
@Property | ||
void validZonedDateTimeIsGenerated(@ForAll("zonedDateTimes") ZonedDateTime zonedDateTime) { | ||
assertThat(zonedDateTime).isNotNull(); | ||
} | ||
|
||
} |