From a6e18d94652a99b3b5080a3a7db7d39365dc6888 Mon Sep 17 00:00:00 2001 From: Steve Date: Fri, 27 May 2022 09:49:07 +0100 Subject: [PATCH] Increase test coverage of functional interfaces --- .../function/FailableDoubleFunctionTest.java | 33 +++++++++++++++++ .../FailableDoubleToIntFunctionTest.java | 33 +++++++++++++++++ .../FailableDoubleToLongFunctionTest.java | 33 +++++++++++++++++ .../lang3/function/FailableFunctionsTest.java | 11 ++++++ .../function/FailableIntFunctionTest.java | 33 +++++++++++++++++ .../FailableIntToDoubleFunctionTest.java | 33 +++++++++++++++++ .../FailableIntToLongFunctionTest.java | 33 +++++++++++++++++ .../function/FailableLongFunctionTest.java | 33 +++++++++++++++++ .../FailableLongToDoubleFunctionTest.java | 33 +++++++++++++++++ .../FailableLongToIntFunctionTest.java | 33 +++++++++++++++++ .../FailableObjDoubleConsumerTest.java | 37 +++++++++++++++++++ .../function/FailableObjIntConsumerTest.java | 37 +++++++++++++++++++ .../function/FailableObjLongConsumerTest.java | 37 +++++++++++++++++++ .../FailableToDoubleBiFunctionTest.java | 33 +++++++++++++++++ .../FailableToDoubleFunctionTest.java | 33 +++++++++++++++++ .../function/FailableToIntBiFunctionTest.java | 33 +++++++++++++++++ .../function/FailableToIntFunctionTest.java | 33 +++++++++++++++++ .../FailableToLongBiFunctionTest.java | 33 +++++++++++++++++ .../function/FailableToLongFunctionTest.java | 33 +++++++++++++++++ 19 files changed, 617 insertions(+) create mode 100644 src/test/java/org/apache/commons/lang3/function/FailableDoubleFunctionTest.java create mode 100644 src/test/java/org/apache/commons/lang3/function/FailableDoubleToIntFunctionTest.java create mode 100644 src/test/java/org/apache/commons/lang3/function/FailableDoubleToLongFunctionTest.java create mode 100644 src/test/java/org/apache/commons/lang3/function/FailableIntFunctionTest.java create mode 100644 src/test/java/org/apache/commons/lang3/function/FailableIntToDoubleFunctionTest.java create mode 100644 src/test/java/org/apache/commons/lang3/function/FailableIntToLongFunctionTest.java create mode 100644 src/test/java/org/apache/commons/lang3/function/FailableLongFunctionTest.java create mode 100644 src/test/java/org/apache/commons/lang3/function/FailableLongToDoubleFunctionTest.java create mode 100644 src/test/java/org/apache/commons/lang3/function/FailableLongToIntFunctionTest.java create mode 100644 src/test/java/org/apache/commons/lang3/function/FailableObjDoubleConsumerTest.java create mode 100644 src/test/java/org/apache/commons/lang3/function/FailableObjIntConsumerTest.java create mode 100644 src/test/java/org/apache/commons/lang3/function/FailableObjLongConsumerTest.java create mode 100644 src/test/java/org/apache/commons/lang3/function/FailableToDoubleBiFunctionTest.java create mode 100644 src/test/java/org/apache/commons/lang3/function/FailableToDoubleFunctionTest.java create mode 100644 src/test/java/org/apache/commons/lang3/function/FailableToIntBiFunctionTest.java create mode 100644 src/test/java/org/apache/commons/lang3/function/FailableToIntFunctionTest.java create mode 100644 src/test/java/org/apache/commons/lang3/function/FailableToLongBiFunctionTest.java create mode 100644 src/test/java/org/apache/commons/lang3/function/FailableToLongFunctionTest.java diff --git a/src/test/java/org/apache/commons/lang3/function/FailableDoubleFunctionTest.java b/src/test/java/org/apache/commons/lang3/function/FailableDoubleFunctionTest.java new file mode 100644 index 000000000..fad989935 --- /dev/null +++ b/src/test/java/org/apache/commons/lang3/function/FailableDoubleFunctionTest.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.function; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertNull; + +/** + * Tests {@link FailableDoubleFunction}. + */ +public class FailableDoubleFunctionTest { + @Test + public void testNop() throws Throwable { + final FailableDoubleFunction func = FailableDoubleFunction.nop(); + assertNull(func.apply(Double.MAX_VALUE), "Expect NOP to return null"); + } +} diff --git a/src/test/java/org/apache/commons/lang3/function/FailableDoubleToIntFunctionTest.java b/src/test/java/org/apache/commons/lang3/function/FailableDoubleToIntFunctionTest.java new file mode 100644 index 000000000..456f12528 --- /dev/null +++ b/src/test/java/org/apache/commons/lang3/function/FailableDoubleToIntFunctionTest.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.function; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * Tests {@link FailableDoubleToIntFunction}. + */ +public class FailableDoubleToIntFunctionTest { + @Test + public void testNop() throws Throwable { + final FailableDoubleToIntFunction func = FailableDoubleToIntFunction.nop(); + assertEquals(0, func.applyAsInt(Double.MAX_VALUE), "Expect NOP to return default value of 0"); + } +} diff --git a/src/test/java/org/apache/commons/lang3/function/FailableDoubleToLongFunctionTest.java b/src/test/java/org/apache/commons/lang3/function/FailableDoubleToLongFunctionTest.java new file mode 100644 index 000000000..8df2d2f0e --- /dev/null +++ b/src/test/java/org/apache/commons/lang3/function/FailableDoubleToLongFunctionTest.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.function; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * Tests {@link FailableDoubleToLongFunction}. + */ +public class FailableDoubleToLongFunctionTest { + @Test + public void testNop() throws Throwable { + final FailableDoubleToLongFunction func = FailableDoubleToLongFunction.nop(); + assertEquals(0, func.applyAsLong(Double.MAX_VALUE), "Expect NOP to return default value of 0"); + } +} diff --git a/src/test/java/org/apache/commons/lang3/function/FailableFunctionsTest.java b/src/test/java/org/apache/commons/lang3/function/FailableFunctionsTest.java index 2b07e38f5..7eb138fa7 100644 --- a/src/test/java/org/apache/commons/lang3/function/FailableFunctionsTest.java +++ b/src/test/java/org/apache/commons/lang3/function/FailableFunctionsTest.java @@ -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)); diff --git a/src/test/java/org/apache/commons/lang3/function/FailableIntFunctionTest.java b/src/test/java/org/apache/commons/lang3/function/FailableIntFunctionTest.java new file mode 100644 index 000000000..8c5d331a6 --- /dev/null +++ b/src/test/java/org/apache/commons/lang3/function/FailableIntFunctionTest.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.function; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertNull; + +/** + * Tests {@link FailableIntFunction}. + */ +public class FailableIntFunctionTest { + @Test + public void testNop() throws Throwable { + final FailableIntFunction func = FailableIntFunction.nop(); + assertNull(func.apply(Integer.MAX_VALUE), "Expect NOP to return null"); + } +} diff --git a/src/test/java/org/apache/commons/lang3/function/FailableIntToDoubleFunctionTest.java b/src/test/java/org/apache/commons/lang3/function/FailableIntToDoubleFunctionTest.java new file mode 100644 index 000000000..656059443 --- /dev/null +++ b/src/test/java/org/apache/commons/lang3/function/FailableIntToDoubleFunctionTest.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.function; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * Tests {@link FailableIntToDoubleFunction}. + */ +public class FailableIntToDoubleFunctionTest { + @Test + public void testNop() throws Throwable { + final FailableIntToDoubleFunction func = FailableIntToDoubleFunction.nop(); + assertEquals(0, func.applyAsDouble(Integer.MAX_VALUE), "Expect NOP to return 0"); + } +} diff --git a/src/test/java/org/apache/commons/lang3/function/FailableIntToLongFunctionTest.java b/src/test/java/org/apache/commons/lang3/function/FailableIntToLongFunctionTest.java new file mode 100644 index 000000000..f394c6949 --- /dev/null +++ b/src/test/java/org/apache/commons/lang3/function/FailableIntToLongFunctionTest.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.function; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * Tests {@link FailableIntToLongFunction}. + */ +public class FailableIntToLongFunctionTest { + @Test + public void testNop() throws Throwable { + final FailableIntToLongFunction func = FailableIntToLongFunction.nop(); + assertEquals(0, func.applyAsLong(Integer.MAX_VALUE), "Expect NOP to return 0"); + } +} diff --git a/src/test/java/org/apache/commons/lang3/function/FailableLongFunctionTest.java b/src/test/java/org/apache/commons/lang3/function/FailableLongFunctionTest.java new file mode 100644 index 000000000..a384d338b --- /dev/null +++ b/src/test/java/org/apache/commons/lang3/function/FailableLongFunctionTest.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.function; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertNull; + +/** + * Tests {@link FailableLongFunction}. + */ +public class FailableLongFunctionTest { + @Test + public void testNop() throws Throwable { + final FailableLongFunction func = FailableLongFunction.nop(); + assertNull(func.apply(Long.MAX_VALUE), "Expect NOP to return null"); + } +} diff --git a/src/test/java/org/apache/commons/lang3/function/FailableLongToDoubleFunctionTest.java b/src/test/java/org/apache/commons/lang3/function/FailableLongToDoubleFunctionTest.java new file mode 100644 index 000000000..ca9ff5e65 --- /dev/null +++ b/src/test/java/org/apache/commons/lang3/function/FailableLongToDoubleFunctionTest.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.function; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * Tests {@link FailableLongToDoubleFunction}. + */ +public class FailableLongToDoubleFunctionTest { + @Test + public void testNop() throws Throwable { + final FailableLongToDoubleFunction func = FailableLongToDoubleFunction.nop(); + assertEquals(0, func.applyAsDouble(Long.MAX_VALUE), "Expect NOP to return 0"); + } +} diff --git a/src/test/java/org/apache/commons/lang3/function/FailableLongToIntFunctionTest.java b/src/test/java/org/apache/commons/lang3/function/FailableLongToIntFunctionTest.java new file mode 100644 index 000000000..6fac99f8e --- /dev/null +++ b/src/test/java/org/apache/commons/lang3/function/FailableLongToIntFunctionTest.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.function; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * Tests {@link FailableLongToIntFunction}. + */ +public class FailableLongToIntFunctionTest { + @Test + public void testNop() throws Throwable { + final FailableLongToIntFunction func = FailableLongToIntFunction.nop(); + assertEquals(0, func.applyAsInt(Long.MAX_VALUE), "Expect NOP to return 0"); + } +} diff --git a/src/test/java/org/apache/commons/lang3/function/FailableObjDoubleConsumerTest.java b/src/test/java/org/apache/commons/lang3/function/FailableObjDoubleConsumerTest.java new file mode 100644 index 000000000..6eba936a7 --- /dev/null +++ b/src/test/java/org/apache/commons/lang3/function/FailableObjDoubleConsumerTest.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.function; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.fail; + +/** + * Tests {@link FailableObjDoubleConsumer}. + */ +public class FailableObjDoubleConsumerTest { + @Test + public void testNop() { + final FailableObjDoubleConsumer func = FailableObjDoubleConsumer.nop(); + try { + func.accept("FOO", Double.MAX_VALUE); + } catch (final Throwable e) { + fail("Accepting NOP must not throw an exception"); + } + } +} diff --git a/src/test/java/org/apache/commons/lang3/function/FailableObjIntConsumerTest.java b/src/test/java/org/apache/commons/lang3/function/FailableObjIntConsumerTest.java new file mode 100644 index 000000000..69e8e9cb3 --- /dev/null +++ b/src/test/java/org/apache/commons/lang3/function/FailableObjIntConsumerTest.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.function; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.fail; + +/** + * Tests {@link FailableObjIntConsumer}. + */ +public class FailableObjIntConsumerTest { + @Test + public void testNop() { + final FailableObjIntConsumer func = FailableObjIntConsumer.nop(); + try { + func.accept("FOO", Integer.MAX_VALUE); + } catch (final Throwable e) { + fail("Accepting NOP must not throw an exception"); + } + } +} diff --git a/src/test/java/org/apache/commons/lang3/function/FailableObjLongConsumerTest.java b/src/test/java/org/apache/commons/lang3/function/FailableObjLongConsumerTest.java new file mode 100644 index 000000000..b41a8c429 --- /dev/null +++ b/src/test/java/org/apache/commons/lang3/function/FailableObjLongConsumerTest.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.function; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.fail; + +/** + * Tests {@link FailableObjLongConsumer}. + */ +public class FailableObjLongConsumerTest { + @Test + public void testNop() { + final FailableObjLongConsumer func = FailableObjLongConsumer.nop(); + try { + func.accept("FOO", Long.MAX_VALUE); + } catch (final Throwable e) { + fail("Accepting NOP must not throw an exception"); + } + } +} diff --git a/src/test/java/org/apache/commons/lang3/function/FailableToDoubleBiFunctionTest.java b/src/test/java/org/apache/commons/lang3/function/FailableToDoubleBiFunctionTest.java new file mode 100644 index 000000000..1b294750e --- /dev/null +++ b/src/test/java/org/apache/commons/lang3/function/FailableToDoubleBiFunctionTest.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.function; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * Tests {@link FailableToDoubleBiFunction}. + */ +public class FailableToDoubleBiFunctionTest { + @Test + public void testNop() throws Throwable { + final FailableToDoubleBiFunction func = FailableToDoubleBiFunction.nop(); + assertEquals(0, func.applyAsDouble("FOO", "BAR"), "Expect NOP to return 0"); + } +} diff --git a/src/test/java/org/apache/commons/lang3/function/FailableToDoubleFunctionTest.java b/src/test/java/org/apache/commons/lang3/function/FailableToDoubleFunctionTest.java new file mode 100644 index 000000000..2c21f9a2b --- /dev/null +++ b/src/test/java/org/apache/commons/lang3/function/FailableToDoubleFunctionTest.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.function; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * Tests {@link FailableToDoubleFunction}. + */ +public class FailableToDoubleFunctionTest { + @Test + public void testNop() throws Throwable { + final FailableToDoubleFunction func = FailableToDoubleFunction.nop(); + assertEquals(0, func.applyAsDouble("FOO"), "Expect NOP to return 0"); + } +} diff --git a/src/test/java/org/apache/commons/lang3/function/FailableToIntBiFunctionTest.java b/src/test/java/org/apache/commons/lang3/function/FailableToIntBiFunctionTest.java new file mode 100644 index 000000000..dad00f73f --- /dev/null +++ b/src/test/java/org/apache/commons/lang3/function/FailableToIntBiFunctionTest.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.function; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * Tests {@link FailableToIntBiFunction}. + */ +public class FailableToIntBiFunctionTest { + @Test + public void testNop() throws Throwable { + final FailableToIntBiFunction func = FailableToIntBiFunction.nop(); + assertEquals(0, func.applyAsInt("FOO", "BAR"), "Expect NOP to return 0"); + } +} diff --git a/src/test/java/org/apache/commons/lang3/function/FailableToIntFunctionTest.java b/src/test/java/org/apache/commons/lang3/function/FailableToIntFunctionTest.java new file mode 100644 index 000000000..97e333542 --- /dev/null +++ b/src/test/java/org/apache/commons/lang3/function/FailableToIntFunctionTest.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.function; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * Tests {@link FailableToIntFunction}. + */ +public class FailableToIntFunctionTest { + @Test + public void testNop() throws Throwable { + final FailableToIntFunction func = FailableToIntFunction.nop(); + assertEquals(0, func.applyAsInt("FOO"), "Expect NOP to return 0"); + } +} diff --git a/src/test/java/org/apache/commons/lang3/function/FailableToLongBiFunctionTest.java b/src/test/java/org/apache/commons/lang3/function/FailableToLongBiFunctionTest.java new file mode 100644 index 000000000..d046771e6 --- /dev/null +++ b/src/test/java/org/apache/commons/lang3/function/FailableToLongBiFunctionTest.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.function; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * Tests {@link FailableToLongBiFunction}. + */ +public class FailableToLongBiFunctionTest { + @Test + public void testNop() throws Throwable { + final FailableToLongBiFunction func = FailableToLongBiFunction.nop(); + assertEquals(0, func.applyAsLong("FOO", "BAR"), "Expect NOP to return 0"); + } +} diff --git a/src/test/java/org/apache/commons/lang3/function/FailableToLongFunctionTest.java b/src/test/java/org/apache/commons/lang3/function/FailableToLongFunctionTest.java new file mode 100644 index 000000000..311e1d84d --- /dev/null +++ b/src/test/java/org/apache/commons/lang3/function/FailableToLongFunctionTest.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.function; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * Tests {@link FailableToLongFunction}. + */ +public class FailableToLongFunctionTest { + @Test + public void testNop() throws Throwable { + final FailableToLongFunction func = FailableToLongFunction.nop(); + assertEquals(0, func.applyAsLong("Foo"), "Expect NOP to return 0"); + } +}