4.6.0
armandino
released this
12 May 22:46
·
48 commits
to main
since this release
What's Changed
New Features
New top-level API filter()
Thefilter()
method can be used to filter generated values using a predicate. If the predicate evaluates to false
for a given value, a new value will be generated. The new value will also be tested against the predicate, and so on.
Example 1: generate a list of even numbers
List<Integer> evenNumbers = Instancio.ofList(Integer.class)
.filter(allInts(), (Integer i) -> i % 2 == 0)
.create();
Example 2: generate a list of objects with unique string and numeric values
Set<?> generatedValues = new HashSet<>();
List<Person> persons = Instancio.ofList(Person.class)
.size(100)
.filter(all(allInts(), allLongs(), allStrings()), generatedValues::add)
.create();
Suport for temporal generator spec min()
and max()
LocalDate maxDate = LocalDate.now().minusYears(18);
Person adult = Instancio.of(Person.class)
.generate(field(Person::getDateOfBirth), gen -> gen.temporal().localDate().max(maxDate))
.create();
// Sample output:
// Person[dateOfBirth=1984-01-26]
- Bump org.apache.maven.plugins:maven-jar-plugin from 3.4.0 to 3.4.1 by @dependabot in #996
- Bump org.apache.maven.plugins:maven-gpg-plugin from 3.2.3 to 3.2.4 by @dependabot in #997
- Bump com.github.siom79.japicmp:japicmp-maven-plugin from 0.20.0 to 0.21.0 by @dependabot in #998
- Bump com.github.siom79.japicmp:japicmp-maven-plugin from 0.21.0 to 0.21.1 by @dependabot in #999
- Bump com.puppycrawl.tools:checkstyle from 10.15.0 to 10.16.0 by @dependabot in #1002
- Bump org.apache.maven.plugins:maven-deploy-plugin from 3.1.1 to 3.1.2 by @dependabot in #1003
- Suport for temporal generator spec
min()
andmax()
by @armandino in #1010 - Bump version.jooq from 3.19.7 to 3.19.8 by @dependabot in #1009
- Bump com.github.spotbugs:spotbugs-maven-plugin from 4.8.4.0 to 4.8.5.0 by @dependabot in #1011
- Bump version.kotlin from 1.9.23 to 1.9.24 by @dependabot in #1013
- Bump com.github.siom79.japicmp:japicmp-maven-plugin from 0.21.1 to 0.21.2 by @dependabot in #1012
- Bug fix:
setModel()
with primitive selectors by @armandino in #1014 - New top-level API
filter()
by @armandino in #1015 - Bump com.google.guava:guava from 33.1.0-jre to 33.2.0-jre by @dependabot in #1008
Full Changelog: instancio-parent-4.5.1...instancio-parent-4.6.0