Last active
November 3, 2017 18:53
-
-
Save winder/c636c02651485431b7989f23573428b4 to your computer and use it in GitHub Desktop.
TestFactory Example
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
@TestFactory | |
public Stream<DynamicTest> dynamicNextTrackMetricsWeeklyTests() { | |
final DateTime now = DateTime.now(); | |
int thisMonthLength = YearMonth.now().lengthOfMonth(); | |
// Week 2-4, track weekly | |
return IntStream.rangeClosed(7, thisMonthLength) | |
.boxed() | |
.map(i -> { | |
Date published = now.minusDays(i).toDate(); | |
Date nextWeek = now.plusWeeks(1).toDate(); | |
return dynamicTest("week < age (" + i + ") < month, track next week.", | |
() -> testNextMetrics(published, now.toDate(), nextWeek)); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment