This commit is contained in:
Gary Gregory 2022-06-07 18:10:02 -04:00
commit a123c892e2
3 changed files with 117 additions and 2 deletions

View File

@ -34,7 +34,7 @@ jobs:
# experimental: true
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3.0.3
- uses: actions/cache@v3.0.4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}

View File

@ -146,7 +146,7 @@ The <action> type attribute can be add,update,fix,remove.
<action type="add" dev="ggregory" due-to="Gary Gregory">Add DurationUtils.since(Temporal).</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add DurationUtils.of(FailableConsumer|FailableRunnbale).</action>
<!-- UPDATE -->
<action type="update" dev="ggregory" due-to="Dependabot, XenoAmess, Gary Gregory">Bump actions/cache from 2.1.4 to 3.0.3 #742, #752, #764, #833, #867.</action>
<action type="update" dev="ggregory" due-to="Dependabot, XenoAmess, Gary Gregory">Bump actions/cache from 2.1.4 to 3.0.4 #742, #752, #764, #833, #867.</action>
<action type="update" dev="ggregory" due-to="Dependabot">Bump actions/checkout from 2 to 3 #819, #825, #859.</action>
<action type="update" dev="ggregory" due-to="Gary Gregory">Bump actions/setup-java from v1.4.3 to 3 #879.</action>
<action type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump spotbugs-maven-plugin from 4.2.0 to 4.7.0.0 #735, #808, #822, #834, #868, #895.</action>

View File

@ -1351,6 +1351,17 @@ public class FailableFunctionsTest {
assertThrows(NullPointerException.class, () -> assertTrue(FailablePredicate.TRUE.and(null).test(null)));
}
@Test
public void testPredicateOr() throws Throwable {
assertTrue(FailablePredicate.TRUE.or(FailablePredicate.TRUE).test(null));
assertTrue(FailablePredicate.TRUE.or(FailablePredicate.FALSE).test(null));
assertTrue(FailablePredicate.FALSE.or(FailablePredicate.TRUE).test(null));
assertFalse(FailablePredicate.FALSE.or(FailablePredicate.FALSE).test(null));
// null tests
assertThrows(NullPointerException.class, () -> assertFalse(FailablePredicate.FALSE.or(null).test(null)));
assertThrows(NullPointerException.class, () -> assertTrue(FailablePredicate.TRUE.or(null).test(null)));
}
@Test
public void testPredicateNegate() throws Throwable {
assertFalse(FailablePredicate.TRUE.negate().test(null));
@ -2552,4 +2563,108 @@ public class FailableFunctionsTest {
assertTrue(closeable.isClosed());
}
@Test
public void testFailableDoubleToIntFunctionNop() throws Throwable {
assertEquals(0, FailableDoubleToIntFunction.nop().applyAsInt(Double.MAX_VALUE), "Expect NOP to return 0");
}
@Test
public void testFailableDoubleToLongFunctionNop() throws Throwable {
assertEquals(0, FailableDoubleToLongFunction.nop().applyAsLong(Double.MAX_VALUE), "Expect NOP to return 0");
}
@Test
public void testFailableIntToDoubleFunctionNop() throws Throwable {
assertEquals(0, FailableIntToDoubleFunction.nop().applyAsDouble(Integer.MAX_VALUE), "Expect NOP to return 0");
}
@Test
public void testFailableIntToLongFunctionNop() throws Throwable {
assertEquals(0, FailableIntToLongFunction.nop().applyAsLong(Integer.MAX_VALUE), "Expect NOP to return 0");
}
@Test
public void testFailableLongToDoubleFunctionNop() throws Throwable {
assertEquals(0, FailableLongToDoubleFunction.nop().applyAsDouble(Long.MAX_VALUE), "Expect NOP to return 0");
}
@Test
public void testFailableLongToIntFunctionNop() throws Throwable {
assertEquals(0, FailableLongToIntFunction.nop().applyAsInt(Long.MAX_VALUE), "Expect NOP to return 0");
}
@Test
public void testFailableToIntFunctionNop() throws Throwable {
assertEquals(0, FailableToIntFunction.nop().applyAsInt("Foo"), "Expect NOP to return 0");
}
@Test
public void testFailableToIntBiFunctionNop() throws Throwable {
assertEquals(0, FailableToIntBiFunction.nop().applyAsInt("Foo", "Bar"), "Expect NOP to return 0");
}
@Test
public void testFailableToLongFunctionNop() throws Throwable {
assertEquals(0, FailableToLongFunction.nop().applyAsLong("Foo"), "Expect NOP to return 0");
}
@Test
public void testFailableToLongBiFunctionNop() throws Throwable {
assertEquals(0, FailableToLongBiFunction.nop().applyAsLong("Foo", "Bar"), "Expect NOP to return 0");
}
@Test
public void testFailableToDoubleFunctionNop() throws Throwable {
assertEquals(0, FailableToDoubleFunction.nop().applyAsDouble("Foo"), "Expect NOP to return 0");
}
@Test
public void testFailableToDoubleBiFunctionNop() throws Throwable {
assertEquals(0, FailableToDoubleBiFunction.nop().applyAsDouble("Foo", "Bar"), "Expect NOP to return 0");
}
@Test
public void testFailableBiFunctionNop() throws Throwable {
assertNull(FailableBiFunction.nop().apply("Foo", "Bar"), "Expect NOP to return null");
}
@Test
public void testFailableDoubleFunctionNop() throws Throwable {
assertNull(FailableDoubleFunction.nop().apply(Double.MAX_VALUE), "Expect NOP to return null");
}
@Test
public void testFailableIntFunctionNop() throws Throwable {
assertNull(FailableIntFunction.nop().apply(Integer.MAX_VALUE), "Expect NOP to return null");
}
@Test
public void testFailableLongFunctionNop() throws Throwable {
assertNull(FailableLongFunction.nop().apply(Long.MAX_VALUE), "Expect NOP to return null");
}
@Test
public void testFailableConsumerNop() throws Throwable {
// Expect nothing thrown
FailableConsumer.nop().accept("Foo");
}
@Test
public void testFailableObjDoubleConsumerNop() throws Throwable {
// Expect nothing thrown
FailableObjDoubleConsumer.nop().accept("Foo", Double.MAX_VALUE);
}
@Test
public void testFailableObjIntConsumerNop() throws Throwable {
// Expect nothing thrown
FailableObjIntConsumer.nop().accept("Foo", Integer.MAX_VALUE);
}
@Test
public void testFailableObjLongConsumerNop() throws Throwable {
// Expect nothing thrown
FailableObjLongConsumer.nop().accept("Foo", Long.MAX_VALUE);
}
}