[LANG-1498] Add support of lambda value evaluation for defaulting

methods #416.

A few more tests.
This commit is contained in:
Gary Gregory 2019-11-01 00:09:59 -04:00
parent a4c60c4e01
commit 8445d3a991
1 changed files with 2 additions and 0 deletions

View File

@ -118,6 +118,8 @@ public void testDefaultIfNull() {
assertSame(o, ObjectUtils.defaultIfNull(o, dflt), "dflt was returned when o was not null");
assertSame(dflt, ObjectUtils.defaultIfNull(null, () -> dflt), "dflt was not returned when o was null");
assertSame(o, ObjectUtils.defaultIfNull(o, () -> dflt), "dflt was returned when o was not null");
assertSame(o, ObjectUtils.defaultIfNull(FOO, () -> dflt), "dflt was returned when o was not null");
assertSame(o, ObjectUtils.defaultIfNull("foo", () -> dflt), "dflt was returned when o was not null");
MutableInt callsCounter = new MutableInt(0);
Supplier<Object> countingDefaultSupplier = () -> {
callsCounter.increment();