jqwik-team / jqwik

Property-Based Testing on the JUnit Platform

Home Page:http://jqwik.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Every X years in @YearRange

derTobsch opened this issue · comments

Testing Problem

I want to get every fifth year from 1945 until 1989 (@YearRange(min = 1945, max = 1989)). So the output should be 1945, 1950, 1955, 1960, ... until 1985.

Is there a way to achieve this?

Not with annotations but using something like:

	@Provide
	Arbitrary<Year> everyFifthYear() {
		return Dates.years().between(1945, 1989)
				   .filter( year ->  year.getValue() % 5 == 0);
	}

should do it.