Repository: yegor256/cactoos
Pull request #72 (2017-06-02 07:58:55)

70: func redesigned
as per #70 

  * `Func` redesigned
  * `FuncApplies`
  * `UncheckedFunc`
  * many other changes


Patch:
diff --git a/.travis.yml b/.travis.yml
index 37963f66..297e4b6c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -6,6 +6,7 @@ cache:
 script:
   - set -e
   - mvn clean install -Pqulice --errors --batch-mode
+  - mvn clean site -Psite --errors --batch-mode
 env:
   global:
     - MAVEN_OPTS="-Xmx256m"
diff --git a/src/main/java/org/cactoos/Func.java b/src/main/java/org/cactoos/Func.java
index 46d48913..aaad18c3 100644
--- a/src/main/java/org/cactoos/Func.java
+++ b/src/main/java/org/cactoos/Func.java
@@ -23,8 +23,6 @@
  */
 package org.cactoos;
 
-import java.util.concurrent.Callable;
-
 /**
  * Function.
  *
@@ -47,102 +45,4 @@ public interface Func<X, Y> {
      */
     Y apply(X input) throws Exception;
 
-    /**
-     * Func that doesn't throw.
-     * @param <X> Input type
-     * @param <Y> Output type
-     */
-    interface Safe<X, Y> extends Func<X, Y> {
-        /**
-         * Apply it safely.
-         * @param input The argument
-         * @return The result
-         */
-        @SuppressWarnings("PMD.AvoidCatchingGenericException")
-        default Y safeApply(X input) {
-            try {
-                return this.apply(input);
-            } catch (final InterruptedException ex) {
-                Thread.currentThread().interrupt();
-                throw new IllegalStateException(ex);
-                // @checkstyle IllegalCatchCheck (1 line)
-            } catch (final Exception ex) {
-                throw new IllegalStateException(ex);
-            }
-        }
-    }
-
-    /**
-     * Quiet func that returns nothing, but is still a function.
-     * @param <X> Input type
-     */
-    interface Quiet<X> extends Func<X, Boolean> {
-        @Override
-        default Boolean apply(X input) throws Exception {
-            this.exec(input);
-            return true;
-        }
-        /**
-         * Execute it.
-         * @param input The argument
-         * @throws Exception If fails
-         */
-        void exec(X input) throws Exception;
-    }
-
-    /**
-     * Func that returns something but doesn't expect any input.
-     * @param <Y> Output type
-     */
-    interface Value<Y> extends Func<Void, Y>, Scalar<Y>, Callable<Y> {
-        @Override
-        default Y apply(Void input) throws Exception {
-            return this.asValue();
-        }
-        @Override
-        default Y call() throws Exception {
-            return this.asValue();
-        }
-    }
-
-    /**
-     * Func that really is a procedure that does something and returns nothing.
-     */
-    interface Proc extends Func<Boolean, Boolean>, Runnable, Callable<Boolean> {
-        @Override
-        default Boolean apply(Boolean input) throws Exception {
-            return this.call();
-        }
-        @Override
-        default Boolean call() throws Exception {
-            this.run();
-            return true;
-        }
-        @Override
-        @SuppressWarnings("PMD.AvoidCatchingGenericException")
-        default void run() {
-            try {
-                this.exec();
-            } catch (final InterruptedException ex) {
-                Thread.currentThread().interrupt();
-                throw new IllegalStateException(ex);
-                // @checkstyle IllegalCatchCheck (1 line)
-            } catch (final Exception ex) {
-                throw new IllegalStateException(ex);
-            }
-        }
-        /**
-         * Execute it.
-         * @throws Exception If fails
-         */
-        void exec() throws Exception;
-    }
-
-    /**
-     * Func that represents a predicate of one argument.
-     * @param <X> Input type
-     */
-    interface Pred<X> extends Func<X, Boolean> {
-    }
-
 }
diff --git a/src/main/java/org/cactoos/FuncApplies.java b/src/main/java/org/cactoos/FuncApplies.java
new file mode 100644
index 00000000..96983eef
--- /dev/null
+++ b/src/main/java/org/cactoos/FuncApplies.java
@@ -0,0 +1,85 @@
+/**
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Yegor Bugayenko
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package org.cactoos;
+
+import org.cactoos.func.UncheckedFunc;
+import org.hamcrest.Description;
+import org.hamcrest.Matcher;
+import org.hamcrest.TypeSafeMatcher;
+import org.hamcrest.core.IsEqual;
+
+/**
+ * Matcher for the value.
+ *
+ * @author Yegor Bugayenko (yegor256@gmail.com)
+ * @version $Id$
+ * @param <X> Type of input
+ * @param <Y> Type of output
+ * @since 0.2
+ */
+public final class FuncApplies<X, Y> extends TypeSafeMatcher<Func<X, Y>> {
+
+    /**
+     * Input of the function.
+     */
+    private final X input;
+
+    /**
+     * Matcher of the result.
+     */
+    private final Matcher<Y> matcher;
+
+    /**
+     * Ctor.
+     * @param result The result expected
+     * @param inpt Input for the function
+     */
+    public FuncApplies(final X inpt, final Y result) {
+        this(inpt, new IsEqual<>(result));
+    }
+
+    /**
+     * Ctor.
+     * @param inpt Input for the function
+     * @param mtr Matcher of the text
+     */
+    public FuncApplies(final X inpt, final Matcher<Y> mtr) {
+        super();
+        this.input = inpt;
+        this.matcher = mtr;
+    }
+
+    @Override
+    public boolean matchesSafely(final Func<X, Y> func) {
+        return this.matcher.matches(
+            new UncheckedFunc<>(func).apply(this.input)
+        );
+    }
+
+    @Override
+    public void describeTo(final Description description) {
+        description.appendText("Scalar with ");
+        description.appendDescriptionOf(this.matcher);
+    }
+}
diff --git a/src/main/java/org/cactoos/Input.java b/src/main/java/org/cactoos/Input.java
index 2e51152c..56822327 100644
--- a/src/main/java/org/cactoos/Input.java
+++ b/src/main/java/org/cactoos/Input.java
@@ -55,6 +55,6 @@ public interface Input {
      * @return InputStream to read from
      * @throws IOException If something goes wrong
      */
-    InputStream stream() throws IOException;
+    InputStream open() throws IOException;
 
 }
diff --git a/src/main/java/org/cactoos/Output.java b/src/main/java/org/cactoos/Output.java
index 7d5c9ff9..54d28f5a 100644
--- a/src/main/java/org/cactoos/Output.java
+++ b/src/main/java/org/cactoos/Output.java
@@ -61,6 +61,6 @@ public interface Output {
      * @return InputStream to read from
      * @throws IOException If something goes wrong
      */
-    OutputStream stream() throws IOException;
+    OutputStream open() throws IOException;
 
 }
diff --git a/src/main/java/org/cactoos/func/AlwaysTrueFunc.java b/src/main/java/org/cactoos/func/AlwaysTrueFunc.java
new file mode 100644
index 00000000..747b1e4f
--- /dev/null
+++ b/src/main/java/org/cactoos/func/AlwaysTrueFunc.java
@@ -0,0 +1,71 @@
+/**
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Yegor Bugayenko
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package org.cactoos.func;
+
+import org.cactoos.Func;
+
+/**
+ * Func as that is always true.
+ *
+ * <p>You may want to use this decorator when you need
+ * a procedure that returns boolean instead of a function:</p>
+ *
+ * <pre> List&lt;String&gt; list = new LinkedList&lt;&gt;();
+ * new AllOf(
+ *   new IterableAsBooleans&lt;String&gt;(
+ *     Collections.emptyList(),
+ *     new AlwaysTrueFunc&lt;&gt;(list::add)
+ *   )
+ * ).asValue();
+ * </pre>
+ *
+ * <p>There is no thread-safety guarantee.
+ *
+ * @author Yegor Bugayenko (yegor256@gmail.com)
+ * @version $Id$
+ * @param <X> Type of input
+ * @since 0.2
+ */
+public final class AlwaysTrueFunc<X> implements Func<X, Boolean> {
+
+    /**
+     * Original func.
+     */
+    private final Func<X, ?> func;
+
+    /**
+     * Ctor.
+     * @param fnc Encapsulated func
+     */
+    public AlwaysTrueFunc(final Func<X, ?> fnc) {
+        this.func = fnc;
+    }
+
+    @Override
+    public Boolean apply(final X input) throws Exception {
+        this.func.apply(input);
+        return true;
+    }
+
+}
diff --git a/src/main/java/org/cactoos/func/CallableAsFunc.java b/src/main/java/org/cactoos/func/CallableAsFunc.java
new file mode 100644
index 00000000..e5c3c7a6
--- /dev/null
+++ b/src/main/java/org/cactoos/func/CallableAsFunc.java
@@ -0,0 +1,62 @@
+/**
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Yegor Bugayenko
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package org.cactoos.func;
+
+import java.util.concurrent.Callable;
+import org.cactoos.Func;
+
+/**
+ * Callable as Func.
+ *
+ * <p>There is no thread-safety guarantee.
+ *
+ * @author Yegor Bugayenko (yegor256@gmail.com)
+ * @version $Id$
+ * @param <X> Type of input
+ * @param <Y> Type of output
+ * @see FuncAsCallable
+ * @see FuncAsRunnable
+ * @see RunnableAsFunc
+ * @since 0.2
+ */
+public final class CallableAsFunc<X, Y> implements Func<X, Y> {
+
+    /**
+     * The callable.
+     */
+    private final Callable<Y> callable;
+
+    /**
+     * Ctor.
+     * @param clbl The callable
+     */
+    public CallableAsFunc(final Callable<Y> clbl) {
+        this.callable = clbl;
+    }
+
+    @Override
+    public Y apply(final X input) throws Exception {
+        return this.callable.call();
+    }
+}
diff --git a/src/main/java/org/cactoos/func/ConstFunc.java b/src/main/java/org/cactoos/func/ConstFunc.java
index ae7d5cef..3f2c8dfb 100644
--- a/src/main/java/org/cactoos/func/ConstFunc.java
+++ b/src/main/java/org/cactoos/func/ConstFunc.java
@@ -26,7 +26,7 @@ package org.cactoos.func;
 import org.cactoos.Func;
 
 /**
- * Func that always returns the same result
+ * Func that always returns the same result.
  *
  * <p>There is no thread-safety guarantee.
  *
diff --git a/src/main/java/org/cactoos/func/FuncAsCallable.java b/src/main/java/org/cactoos/func/FuncAsCallable.java
new file mode 100644
index 00000000..2862f574
--- /dev/null
+++ b/src/main/java/org/cactoos/func/FuncAsCallable.java
@@ -0,0 +1,66 @@
+/**
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Yegor Bugayenko
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package org.cactoos.func;
+
+import java.util.concurrent.Callable;
+import org.cactoos.Func;
+
+/**
+ * Func as {@link Callable}.
+ *
+ * <p>You may want to use this decorator where
+ * {@link Callable} is required, but you just have a function:</p>
+ *
+ * <pre> Callable&lt;String&gt; callable = new FuncAsCallable&lt;&gt;(
+ *   i -&gt; "Hello, world!"
+ * );
+ * </pre>
+ *
+ * <p>There is no thread-safety guarantee.
+ *
+ * @author Yegor Bugayenko (yegor256@gmail.com)
+ * @version $Id$
+ * @param <T> Type of input
+ * @since 0.2
+ */
+public final class FuncAsCallable<T> implements Callable<T> {
+
+    /**
+     * Original func.
+     */
+    private final Func<?, T> func;
+
+    /**
+     * Ctor.
+     * @param fnc Encapsulated func
+     */
+    public FuncAsCallable(final Func<?, T> fnc) {
+        this.func = fnc;
+    }
+
+    @Override
+    public T call() throws Exception {
+        return this.func.apply(null);
+    }
+}
diff --git a/src/main/java/org/cactoos/func/FuncAsMatcher.java b/src/main/java/org/cactoos/func/FuncAsMatcher.java
index 85f44845..b7f31ebd 100644
--- a/src/main/java/org/cactoos/func/FuncAsMatcher.java
+++ b/src/main/java/org/cactoos/func/FuncAsMatcher.java
@@ -54,14 +54,8 @@ public final class FuncAsMatcher<T> extends TypeSafeMatcher<T> {
     }
 
     @Override
-    @SuppressWarnings("PMD.AvoidCatchingGenericException")
     public boolean matchesSafely(final T item) {
-        try {
-            return this.func.apply(item);
-            // @checkstyle IllegalCatchCheck (1 line)
-        } catch (final Exception ex) {
-            throw new AssertionError(ex);
-        }
+        return new UncheckedFunc<>(this.func).apply(item);
     }
 
     @Override
diff --git a/src/main/java/org/cactoos/func/FuncAsProc.java b/src/main/java/org/cactoos/func/FuncAsRunnable.java
similarity index 85%
rename from src/main/java/org/cactoos/func/FuncAsProc.java
rename to src/main/java/org/cactoos/func/FuncAsRunnable.java
index 7273728c..657c1357 100644
--- a/src/main/java/org/cactoos/func/FuncAsProc.java
+++ b/src/main/java/org/cactoos/func/FuncAsRunnable.java
@@ -32,26 +32,25 @@ import org.cactoos.Func;
  *
  * @author Yegor Bugayenko (yegor256@gmail.com)
  * @version $Id$
- * @since 0.1
+ * @since 0.2
  */
-public final class FuncAsProc implements Func.Proc {
+public final class FuncAsRunnable implements Runnable {
 
     /**
-     * The func.
+     * Original func.
      */
     private final Func<?, ?> func;
 
     /**
      * Ctor.
-     * @param fnc The func
+     * @param fnc Encapsulated func
      */
-    public FuncAsProc(final Func<?, ?> fnc) {
+    public FuncAsRunnable(final Func<?, ?> fnc) {
         this.func = fnc;
     }
 
     @Override
-    public void exec() throws Exception {
-        this.func.apply(null);
+    public void run() {
+        new UncheckedFunc<>(this.func).apply(null);
     }
-
 }
diff --git a/src/main/java/org/cactoos/func/RunnableAsProc.java b/src/main/java/org/cactoos/func/RunnableAsFunc.java
similarity index 84%
rename from src/main/java/org/cactoos/func/RunnableAsProc.java
rename to src/main/java/org/cactoos/func/RunnableAsFunc.java
index 114f51a3..5cb6a170 100644
--- a/src/main/java/org/cactoos/func/RunnableAsProc.java
+++ b/src/main/java/org/cactoos/func/RunnableAsFunc.java
@@ -32,9 +32,14 @@ import org.cactoos.Func;
  *
  * @author Yegor Bugayenko (yegor256@gmail.com)
  * @version $Id$
+ * @param <X> Type of input
+ * @param <Y> Type of output
+ * @see FuncAsCallable
+ * @see FuncAsRunnable
+ * @see CallableAsFunc
  * @since 0.2
  */
-public final class RunnableAsProc implements Func.Proc {
+public final class RunnableAsFunc<X, Y> implements Func<X, Y> {
 
     /**
      * The runnable.
@@ -45,13 +50,13 @@ public final class RunnableAsProc implements Func.Proc {
      * Ctor.
      * @param rnbl The runnable
      */
-    public RunnableAsProc(final Runnable rnbl) {
+    public RunnableAsFunc(final Runnable rnbl) {
         this.runnable = rnbl;
     }
 
     @Override
-    public void exec() {
+    public Y apply(final X input) {
         this.runnable.run();
+        return null;
     }
-
 }
diff --git a/src/main/java/org/cactoos/func/UncheckedFunc.java b/src/main/java/org/cactoos/func/UncheckedFunc.java
new file mode 100644
index 00000000..b6258247
--- /dev/null
+++ b/src/main/java/org/cactoos/func/UncheckedFunc.java
@@ -0,0 +1,68 @@
+/**
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Yegor Bugayenko
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package org.cactoos.func;
+
+import org.cactoos.Func;
+
+/**
+ * Func that doesn't throw checked {@link Exception}.
+ *
+ * <p>There is no thread-safety guarantee.
+ *
+ * @author Yegor Bugayenko (yegor256@gmail.com)
+ * @version $Id$
+ * @param <X> Type of input
+ * @param <Y> Type of output
+ * @since 0.2
+ */
+public final class UncheckedFunc<X, Y> implements Func<X, Y> {
+
+    /**
+     * Original func.
+     */
+    private final Func<X, Y> func;
+
+    /**
+     * Ctor.
+     * @param fnc Encapsulated func
+     */
+    public UncheckedFunc(final Func<X, Y> fnc) {
+        this.func = fnc;
+    }
+
+    @Override
+    @SuppressWarnings("PMD.AvoidCatchingGenericException")
+    public Y apply(final X input) {
+        try {
+            return this.func.apply(input);
+        } catch (final InterruptedException ex) {
+            Thread.currentThread().interrupt();
+            throw new IllegalStateException(ex);
+            // @checkstyle IllegalCatchCheck (1 line)
+        } catch (final Exception ex) {
+            throw new IllegalStateException(ex);
+        }
+    }
+
+}
diff --git a/src/main/java/org/cactoos/io/BytesAsInput.java b/src/main/java/org/cactoos/io/BytesAsInput.java
index 1eabae55..6717756b 100644
--- a/src/main/java/org/cactoos/io/BytesAsInput.java
+++ b/src/main/java/org/cactoos/io/BytesAsInput.java
@@ -54,7 +54,7 @@ public final class BytesAsInput implements Input {
     }
 
     @Override
-    public InputStream stream() throws IOException {
+    public InputStream open() throws IOException {
         return new ByteArrayInputStream(
             this.source.asBytes()
         );
diff --git a/src/main/java/org/cactoos/io/DeadInput.java b/src/main/java/org/cactoos/io/DeadInput.java
index 5b4ac9b7..4d3a2b8c 100644
--- a/src/main/java/org/cactoos/io/DeadInput.java
+++ b/src/main/java/org/cactoos/io/DeadInput.java
@@ -40,8 +40,8 @@ import org.cactoos.text.EmptyBytes;
 public final class DeadInput implements Input {
 
     @Override
-    public InputStream stream() throws IOException {
-        return new BytesAsInput(new EmptyBytes()).stream();
+    public InputStream open() throws IOException {
+        return new BytesAsInput(new EmptyBytes()).open();
     }
 
 }
diff --git a/src/main/java/org/cactoos/io/DeadOutput.java b/src/main/java/org/cactoos/io/DeadOutput.java
index c569206a..0a6ce358 100644
--- a/src/main/java/org/cactoos/io/DeadOutput.java
+++ b/src/main/java/org/cactoos/io/DeadOutput.java
@@ -38,7 +38,7 @@ import org.cactoos.Output;
 public final class DeadOutput implements Output {
 
     @Override
-    public OutputStream stream() {
+    public OutputStream open() {
         return new OutputStream() {
             @Override
             @SuppressWarnings("PMD.UncommentedEmptyMethodBody")
diff --git a/src/main/java/org/cactoos/io/FileAsInput.java b/src/main/java/org/cactoos/io/FileAsInput.java
index e7611e83..92ca03f2 100644
--- a/src/main/java/org/cactoos/io/FileAsInput.java
+++ b/src/main/java/org/cactoos/io/FileAsInput.java
@@ -54,7 +54,7 @@ public final class FileAsInput implements Input {
     }
 
     @Override
-    public InputStream stream() throws FileNotFoundException {
+    public InputStream open() throws FileNotFoundException {
         return new FileInputStream(this.file);
     }
 
diff --git a/src/main/java/org/cactoos/io/FileAsOutput.java b/src/main/java/org/cactoos/io/FileAsOutput.java
index 0a2a056c..01ec6568 100644
--- a/src/main/java/org/cactoos/io/FileAsOutput.java
+++ b/src/main/java/org/cactoos/io/FileAsOutput.java
@@ -54,7 +54,7 @@ public final class FileAsOutput implements Output {
     }
 
     @Override
-    public OutputStream stream() throws FileNotFoundException {
+    public OutputStream open() throws FileNotFoundException {
         return new FileOutputStream(this.file);
     }
 
diff --git a/src/main/java/org/cactoos/io/InputAsBytes.java b/src/main/java/org/cactoos/io/InputAsBytes.java
index 667edddc..1949c7b3 100644
--- a/src/main/java/org/cactoos/io/InputAsBytes.java
+++ b/src/main/java/org/cactoos/io/InputAsBytes.java
@@ -75,7 +75,7 @@ public final class InputAsBytes implements Bytes {
             final InputStream stream = new TeeInput(
                 this.source,
                 new OutputStreamAsOutput(baos)
-            ).stream();
+            ).open();
             final byte[] buf = new byte[this.size];
             while (true) {
                 if (stream.read(buf) != buf.length) {
diff --git a/src/main/java/org/cactoos/io/InputStreamAsInput.java b/src/main/java/org/cactoos/io/InputStreamAsInput.java
index 60707d93..8bd2214f 100644
--- a/src/main/java/org/cactoos/io/InputStreamAsInput.java
+++ b/src/main/java/org/cactoos/io/InputStreamAsInput.java
@@ -51,7 +51,7 @@ public final class InputStreamAsInput implements Input {
     }
 
     @Override
-    public InputStream stream() {
+    public InputStream open() {
         return this.input;
     }
 
diff --git a/src/main/java/org/cactoos/io/LengthOfInput.java b/src/main/java/org/cactoos/io/LengthOfInput.java
index 2fa55ce1..4ea1b7bd 100644
--- a/src/main/java/org/cactoos/io/LengthOfInput.java
+++ b/src/main/java/org/cactoos/io/LengthOfInput.java
@@ -70,7 +70,7 @@ public final class LengthOfInput implements Scalar<Long> {
 
     @Override
     public Long asValue() throws IOException {
-        final InputStream stream = this.source.stream();
+        final InputStream stream = this.source.open();
         final byte[] buf = new byte[this.size];
         long length = 0L;
         while (true) {
diff --git a/src/main/java/org/cactoos/io/OutputStreamAsOutput.java b/src/main/java/org/cactoos/io/OutputStreamAsOutput.java
index b390fe4c..e51d60ad 100644
--- a/src/main/java/org/cactoos/io/OutputStreamAsOutput.java
+++ b/src/main/java/org/cactoos/io/OutputStreamAsOutput.java
@@ -51,7 +51,7 @@ public final class OutputStreamAsOutput implements Output {
     }
 
     @Override
-    public OutputStream stream() {
+    public OutputStream open() {
         return this.output;
     }
 
diff --git a/src/main/java/org/cactoos/io/ResourceAsInput.java b/src/main/java/org/cactoos/io/ResourceAsInput.java
index ed8dbf9b..dd9bb083 100644
--- a/src/main/java/org/cactoos/io/ResourceAsInput.java
+++ b/src/main/java/org/cactoos/io/ResourceAsInput.java
@@ -72,7 +72,7 @@ public final class ResourceAsInput implements Input {
     }
 
     @Override
-    public InputStream stream() throws IOException {
+    public InputStream open() throws IOException {
         final InputStream input = this.loader.getResourceAsStream(this.path);
         if (input == null) {
             throw new IOException(
diff --git a/src/main/java/org/cactoos/io/TeeInput.java b/src/main/java/org/cactoos/io/TeeInput.java
index 246c6d81..fc7656d4 100644
--- a/src/main/java/org/cactoos/io/TeeInput.java
+++ b/src/main/java/org/cactoos/io/TeeInput.java
@@ -60,9 +60,9 @@ public final class TeeInput implements Input {
     }
 
     @Override
-    public InputStream stream() throws IOException {
+    public InputStream open() throws IOException {
         return new TeeInputStream(
-            this.source.stream(), this.target.stream()
+            this.source.open(), this.target.open()
         );
     }
 
diff --git a/src/main/java/org/cactoos/io/UrlAsInput.java b/src/main/java/org/cactoos/io/UrlAsInput.java
index 6fc8588a..34eeefd2 100644
--- a/src/main/java/org/cactoos/io/UrlAsInput.java
+++ b/src/main/java/org/cactoos/io/UrlAsInput.java
@@ -53,7 +53,7 @@ public final class UrlAsInput implements Input {
     }
 
     @Override
-    public InputStream stream() throws IOException {
+    public InputStream open() throws IOException {
         return this.source.openStream();
     }
 
diff --git a/src/main/java/org/cactoos/list/FilteredIterable.java b/src/main/java/org/cactoos/list/FilteredIterable.java
index 1a2292d0..be6acb85 100644
--- a/src/main/java/org/cactoos/list/FilteredIterable.java
+++ b/src/main/java/org/cactoos/list/FilteredIterable.java
@@ -29,11 +29,24 @@ import org.cactoos.Func;
 /**
  * Filtered iterable.
  *
+ * <p>You can use it in order to create a declarative/lazy
+ * version of a filtered collection/iterable. For example,
+ * this code will create a list of two strings "hello" and "world":</p>
+ *
+ * <pre> Iterable&lt;String&gt; list = new FilteredIterable&lt;&gt;(
+ *   new ArrayAsIterable&lt;&gt;(
+ *     "hey", "hello", "world"
+ *   ),
+ *   input -&gt; input.length() &gt; 4
+ * );
+ * </pre>
+ *
  * <p>There is no thread-safety guarantee.
  *
  * @author Yegor Bugayenko (yegor256@gmail.com)
  * @version $Id$
  * @param <X> Type of item
+ * @see FilteredIterator
  * @since 0.1
  */
 public final class FilteredIterable<X> implements Iterable<X> {
@@ -46,23 +59,23 @@ public final class FilteredIterable<X> implements Iterable<X> {
     /**
      * Function.
      */
-    private final Func.Pred<X> pred;
+    private final Func<X, Boolean> func;
 
     /**
      * Ctor.
      * @param src Source iterable
-     * @param pred Predicate
+     * @param fnc Predicate
      */
-    public FilteredIterable(final Iterable<X> src, final Func.Pred<X> pred) {
+    public FilteredIterable(final Iterable<X> src, final Func<X, Boolean> fnc) {
         this.iterable = src;
-        this.pred = pred;
+        this.func = fnc;
     }
 
     @Override
     public Iterator<X> iterator() {
         return new FilteredIterator<>(
             this.iterable.iterator(),
-            this.pred
+            this.func
         );
     }
 
diff --git a/src/main/java/org/cactoos/list/FilteredIterator.java b/src/main/java/org/cactoos/list/FilteredIterator.java
index 22f3b6d1..a4c7739e 100644
--- a/src/main/java/org/cactoos/list/FilteredIterator.java
+++ b/src/main/java/org/cactoos/list/FilteredIterator.java
@@ -28,15 +28,29 @@ import java.util.LinkedList;
 import java.util.NoSuchElementException;
 import java.util.Queue;
 import org.cactoos.Func;
+import org.cactoos.func.UncheckedFunc;
 
 /**
  * Filtered iterator.
  *
+ * <p>You can use it in order to create a declarative/lazy
+ * version of a filtered collection/iterable. For example,
+ * this code will create a list of two strings "hello" and "world":</p>
+ *
+ * <pre> Iterator&lt;String&gt; list = new FilteredIterator&lt;&gt;(
+ *   new ArrayAsIterable&lt;&gt;(
+ *     "hey", "hello", "world"
+ *   ).iterator(),
+ *   input -&gt; input.length() &gt; 4
+ * );
+ * </pre>
+ *
  * <p>There is no thread-safety guarantee.
  *
  * @author Yegor Bugayenko (yegor256@gmail.com)
  * @version $Id$
  * @param <X> Type of item
+ * @see FilteredIterable
  * @since 0.1
  */
 public final class FilteredIterator<X> implements Iterator<X> {
@@ -49,7 +63,7 @@ public final class FilteredIterator<X> implements Iterator<X> {
     /**
      * Predicate.
      */
-    private final Func.Pred<X> pred;
+    private final Func<X, Boolean> func;
 
     /**
      * The buffer storing the objects of the iterator.
@@ -59,28 +73,23 @@ public final class FilteredIterator<X> implements Iterator<X> {
     /**
      * Ctor.
      * @param src Source iterable
-     * @param pred Predicate
+     * @param fnc Predicate
      */
-    public FilteredIterator(final Iterator<X> src, final Func.Pred<X> pred) {
+    public FilteredIterator(final Iterator<X> src, final Func<X, Boolean> fnc) {
         this.iterator = src;
-        this.pred = pred;
+        this.func = fnc;
         this.buffer = new LinkedList<>();
     }
 
     @Override
-    @SuppressWarnings("PMD.AvoidCatchingGenericException")
     public boolean hasNext() {
+        final UncheckedFunc<X, Boolean> fnc = new UncheckedFunc<>(this.func);
         if (this.buffer.isEmpty()) {
             while (this.iterator.hasNext()) {
                 final X object = this.iterator.next();
-                try {
-                    if (this.pred.apply(object)) {
-                        this.buffer.add(object);
-                        break;
-                    }
-                    // @checkstyle IllegalCatchCheck (1 line)
-                } catch (final Exception ex) {
-                    throw new IllegalStateException(ex);
+                if (fnc.apply(object)) {
+                    this.buffer.add(object);
+                    break;
                 }
             }
         }
diff --git a/src/main/java/org/cactoos/list/IterableAsBoolean.java b/src/main/java/org/cactoos/list/IterableAsBoolean.java
index 31b91f4e..6352b4b8 100644
--- a/src/main/java/org/cactoos/list/IterableAsBoolean.java
+++ b/src/main/java/org/cactoos/list/IterableAsBoolean.java
@@ -42,6 +42,7 @@ import org.cactoos.Scalar;
  * @author Yegor Bugayenko (yegor256@gmail.com)
  * @version $Id$
  * @param <X> Type of source item
+ * @see IterableAsBooleans
  * @since 0.1
  */
 public final class IterableAsBoolean<X> implements Scalar<Boolean> {
diff --git a/src/main/java/org/cactoos/list/IterableAsBooleans.java b/src/main/java/org/cactoos/list/IterableAsBooleans.java
index ee1efd9c..98c50a1c 100644
--- a/src/main/java/org/cactoos/list/IterableAsBooleans.java
+++ b/src/main/java/org/cactoos/list/IterableAsBooleans.java
@@ -46,6 +46,7 @@ import org.cactoos.Func;
  * @author Yegor Bugayenko (yegor256@gmail.com)
  * @version $Id$
  * @param <X> Type of source item
+ * @see IterableAsBoolean
  * @since 0.1
  */
 public final class IterableAsBooleans<X> implements Iterable<Boolean> {
diff --git a/src/main/java/org/cactoos/list/TransformedIterator.java b/src/main/java/org/cactoos/list/TransformedIterator.java
index b4768525..fe3424e5 100644
--- a/src/main/java/org/cactoos/list/TransformedIterator.java
+++ b/src/main/java/org/cactoos/list/TransformedIterator.java
@@ -25,6 +25,7 @@ package org.cactoos.list;
 
 import java.util.Iterator;
 import org.cactoos.Func;
+import org.cactoos.func.UncheckedFunc;
 
 /**
  * Transformed iterator.
@@ -67,12 +68,7 @@ public final class TransformedIterator<X, Y> implements Iterator<Y> {
     @Override
     @SuppressWarnings("PMD.AvoidCatchingGenericException")
     public Y next() {
-        try {
-            return this.func.apply(this.iterator.next());
-            // @checkstyle IllegalCatchCheck (1 line)
-        } catch (final Exception ex) {
-            throw new IllegalStateException(ex);
-        }
+        return new UncheckedFunc<>(this.func).apply(this.iterator.next());
     }
 
     @Override
diff --git a/src/main/java/org/cactoos/package-info.java b/src/main/java/org/cactoos/package-info.java
index 0fea2db6..fce172b3 100644
--- a/src/main/java/org/cactoos/package-info.java
+++ b/src/main/java/org/cactoos/package-info.java
@@ -25,9 +25,17 @@
 /**
  * Cactoos.
  *
+ * <p>This is a collection of Java primitives designed in a rather
+ * extreme object-objected manner. More details about our design
+ * decisions you can find in this
+ * <a href="https://github.com/yegor256/cactoos/blob/master/README.md">README</a>.
+ * Feel free to contribute, if you find issues or have a need for
+ * some other primitives.</p>
+ *
  * @author Yegor Bugayenko (yegor256@gmail.com)
  * @version $Id$
  * @since 0.1
- * @see <a href="http://www.takes.org">project site www.cactoos.org</a>
+ * @see <a href="http://www.cactoos.org">Project site www.cactoos.org</a>
+ * @see <a href="https://github.com/yegor256/cactoos">GitHub repository</a>
  */
 package org.cactoos;


Test patch:
diff --git a/src/test/java/org/cactoos/func/ConstFuncTest.java b/src/test/java/org/cactoos/func/ConstFuncTest.java
new file mode 100644
index 00000000..53823302
--- /dev/null
+++ b/src/test/java/org/cactoos/func/ConstFuncTest.java
@@ -0,0 +1,49 @@
+/**
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Yegor Bugayenko
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package org.cactoos.func;
+
+import org.cactoos.FuncApplies;
+import org.hamcrest.MatcherAssert;
+import org.junit.Test;
+
+/**
+ * Test case for {@link ConstFunc}.
+ *
+ * @author Yegor Bugayenko (yegor256@gmail.com)
+ * @version $Id$
+ * @since 0.2
+ * @checkstyle JavadocMethodCheck (500 lines)
+ */
+public final class ConstFuncTest {
+
+    @Test
+    public void returnsConstant() {
+        MatcherAssert.assertThat(
+            "Can't return a constant",
+            new ConstFunc<>(1),
+            new FuncApplies<>(-1, 1)
+        );
+    }
+
+}
diff --git a/src/test/java/org/cactoos/func/FuncAsCallableTest.java b/src/test/java/org/cactoos/func/FuncAsCallableTest.java
new file mode 100644
index 00000000..23807c35
--- /dev/null
+++ b/src/test/java/org/cactoos/func/FuncAsCallableTest.java
@@ -0,0 +1,50 @@
+/**
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Yegor Bugayenko
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package org.cactoos.func;
+
+import org.hamcrest.MatcherAssert;
+import org.hamcrest.Matchers;
+import org.junit.Test;
+
+/**
+ * Test case for {@link FuncAsCallable}.
+ *
+ * @author Yegor Bugayenko (yegor256@gmail.com)
+ * @version $Id$
+ * @since 0.2
+ * @checkstyle JavadocMethodCheck (500 lines)
+ */
+public final class FuncAsCallableTest {
+
+    @Test
+    public void convertsFuncIntoCallable() throws Exception {
+        MatcherAssert.assertThat(
+            new FuncAsCallable<>(
+                input -> 1
+            ).call(),
+            Matchers.equalTo(1)
+        );
+    }
+
+}
diff --git a/src/test/java/org/cactoos/func/FuncAsRunnableTest.java b/src/test/java/org/cactoos/func/FuncAsRunnableTest.java
new file mode 100644
index 00000000..8d3571f9
--- /dev/null
+++ b/src/test/java/org/cactoos/func/FuncAsRunnableTest.java
@@ -0,0 +1,60 @@
+/**
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Yegor Bugayenko
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package org.cactoos.func;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+import org.hamcrest.MatcherAssert;
+import org.junit.Test;
+
+/**
+ * Test case for {@link FuncAsRunnable}.
+ *
+ * @author Yegor Bugayenko (yegor256@gmail.com)
+ * @version $Id$
+ * @since 0.2
+ * @checkstyle JavadocMethodCheck (500 lines)
+ */
+public final class FuncAsRunnableTest {
+
+    @Test
+    public void convertsFuncIntoRunnable() throws Exception {
+        final AtomicBoolean done = new AtomicBoolean();
+        MatcherAssert.assertThat(
+            "Can't execute Runnable",
+            new FuncAsRunnable(
+                input -> {
+                    done.set(true);
+                    return 1;
+                }
+            ),
+            new FuncAsMatcher<Runnable>(
+                input -> {
+                    input.run();
+                    return done.get();
+                }
+            )
+        );
+    }
+
+}
diff --git a/src/test/java/org/cactoos/func/FuncWithCallbackTest.java b/src/test/java/org/cactoos/func/FuncWithCallbackTest.java
index e4103ed4..44f4c89f 100644
--- a/src/test/java/org/cactoos/func/FuncWithCallbackTest.java
+++ b/src/test/java/org/cactoos/func/FuncWithCallbackTest.java
@@ -24,7 +24,7 @@
 package org.cactoos.func;
 
 import java.io.IOException;
-import org.cactoos.Func;
+import org.cactoos.FuncApplies;
 import org.hamcrest.MatcherAssert;
 import org.hamcrest.Matchers;
 import org.junit.Test;
@@ -44,10 +44,10 @@ public final class FuncWithCallbackTest {
         MatcherAssert.assertThat(
             "Can't use the main function if no exception",
             new FuncWithCallback<>(
-                (Func<Integer, String>) input -> "It's success",
+                input -> "It's success",
                 ex -> "In case of failure..."
-            ).apply(1),
-            Matchers.containsString("success")
+            ),
+            new FuncApplies<>(1, Matchers.containsString("success"))
         );
     }
 
@@ -56,12 +56,12 @@ public final class FuncWithCallbackTest {
         MatcherAssert.assertThat(
             "Can't use the callback in case of exception",
             new FuncWithCallback<>(
-                (Func<Integer, String>) input -> {
+                input -> {
                     throw new IOException("Failure");
                 },
                 ex -> "Never mind"
-            ).apply(1),
-            Matchers.containsString("Never")
+            ),
+            new FuncApplies<>(1, Matchers.containsString("Never"))
         );
     }
 
diff --git a/src/test/java/org/cactoos/func/UncheckedFuncTest.java b/src/test/java/org/cactoos/func/UncheckedFuncTest.java
new file mode 100644
index 00000000..1ec4ee5f
--- /dev/null
+++ b/src/test/java/org/cactoos/func/UncheckedFuncTest.java
@@ -0,0 +1,49 @@
+/**
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Yegor Bugayenko
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package org.cactoos.func;
+
+import java.io.IOException;
+import org.cactoos.Func;
+import org.junit.Test;
+
+/**
+ * Test case for {@link UncheckedFunc}.
+ *
+ * @author Yegor Bugayenko (yegor256@gmail.com)
+ * @version $Id$
+ * @since 0.2
+ * @checkstyle JavadocMethodCheck (500 lines)
+ */
+public final class UncheckedFuncTest {
+
+    @Test(expected = RuntimeException.class)
+    public void rethrowsCheckedToUncheckedException() {
+        new UncheckedFunc<>(
+            (Func<Integer, String>) i -> {
+                throw new IOException("intended");
+            }
+        ).apply(1);
+    }
+
+}
diff --git a/src/test/java/org/cactoos/io/ResourceAsInputTest.java b/src/test/java/org/cactoos/io/ResourceAsInputTest.java
index d2b9e10f..20e2e947 100644
--- a/src/test/java/org/cactoos/io/ResourceAsInputTest.java
+++ b/src/test/java/org/cactoos/io/ResourceAsInputTest.java
@@ -60,4 +60,5 @@ public final class ResourceAsInputTest {
             )
         );
     }
+
 }
diff --git a/src/test/java/org/cactoos/list/AllOfTest.java b/src/test/java/org/cactoos/list/AllOfTest.java
index a440ace2..92963287 100644
--- a/src/test/java/org/cactoos/list/AllOfTest.java
+++ b/src/test/java/org/cactoos/list/AllOfTest.java
@@ -26,8 +26,8 @@ package org.cactoos.list;
 import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
-import org.cactoos.Func;
 import org.cactoos.ScalarHasValue;
+import org.cactoos.func.AlwaysTrueFunc;
 import org.cactoos.func.FuncAsMatcher;
 import org.hamcrest.MatcherAssert;
 import org.hamcrest.Matchers;
@@ -50,7 +50,7 @@ public final class AllOfTest {
             new AllOf(
                 new TransformedIterable<>(
                     new ArrayAsIterable<>("hello", "world"),
-                    (Func.Quiet<String>) list::add
+                    list::add
                 )
             ),
             new ScalarHasValue<>(
@@ -70,9 +70,9 @@ public final class AllOfTest {
         MatcherAssert.assertThat(
             "Can't iterate a list",
             new AllOf(
-                new IterableAsBooleans<>(
+                new IterableAsBooleans<String>(
                     Collections.emptyList(),
-                    (Func.Quiet<String>) list::add
+                    new AlwaysTrueFunc<>(list::add)
                 )
             ),
             new ScalarHasValue<>(