Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Dec 27, 2017
2 parents e36349a + f15a9a3 commit 2c9ef05
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 218 deletions.
215 changes: 0 additions & 215 deletions src/main/java/org/cactoos/func/FuncWithFallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
*/
package org.cactoos.func;

import java.util.concurrent.Callable;
import org.cactoos.Func;
import org.cactoos.Proc;

/**
* Func with a fallback plan.
Expand Down Expand Up @@ -65,219 +63,6 @@ public FuncWithFallback(final Func<X, Y> fnc,
this(fnc, fbk, input -> input);
}

/**
* Ctor.
* @param proc The proc
* @param fbk The fallback
* @since 0.12
*/
public FuncWithFallback(final Proc<X> proc,
final Func<Throwable, Y> fbk) {
this(new FuncOf<>(proc), fbk);
}

/**
* Ctor.
* @param proc The proc
* @param fbk The fallback
* @since 0.12
*/
public FuncWithFallback(final Proc<X> proc,
final Proc<Throwable> fbk) {
this(new FuncOf<>(proc), new FuncOf<>(fbk));
}

/**
* Ctor.
* @param proc The proc
* @param fbk The fallback
* @since 0.12
*/
public FuncWithFallback(final Func<X, Y> proc,
final Proc<Throwable> fbk) {
this(proc, new FuncOf<>(fbk));
}

/**
* Ctor.
* @param fnc The func
* @param fbk The fallback
* @param flw The follow up func
* @since 0.12
*/
public FuncWithFallback(final Func<X, Y> fnc,
final Proc<Throwable> fbk, final Func<Y, Y> flw) {
this(fnc, new FuncOf<>(fbk), flw);
}

/**
* Ctor.
* @param fnc The func
* @param fbk The fallback
* @param flw The follow up func
* @since 0.12
*/
public FuncWithFallback(final Func<X, Y> fnc,
final Proc<Throwable> fbk, final Proc<Y> flw) {
this(fnc, new FuncOf<>(fbk), new FuncOf<>(flw));
}

/**
* Ctor.
* @param fnc The func
* @param fbk The fallback
* @param flw The follow up func
* @since 0.12
*/
public FuncWithFallback(final Func<X, Y> fnc,
final Func<Throwable, Y> fbk, final Proc<Y> flw) {
this(fnc, fbk, new FuncOf<>(flw));
}

/**
* Ctor.
* @param fnc The func
* @param fbk The fallback
* @param flw The follow up func
* @since 0.12
*/
public FuncWithFallback(final Proc<X> fnc,
final Func<Throwable, Y> fbk, final Func<Y, Y> flw) {
this(new FuncOf<>(fnc), fbk, flw);
}

/**
* Ctor.
* @param fnc The func
* @param fbk The fallback
* @param flw The follow up func
* @since 0.12
*/
public FuncWithFallback(final Proc<X> fnc,
final Proc<Throwable> fbk, final Func<Y, Y> flw) {
this(new FuncOf<>(fnc), fbk, flw);
}

/**
* Ctor.
* @param fnc The func
* @param fbk The fallback
* @param flw The follow up func
* @since 0.12
*/
public FuncWithFallback(final Proc<X> fnc,
final Proc<Throwable> fbk, final Proc<Y> flw) {
this(new FuncOf<>(fnc), fbk, flw);
}

/**
* Ctor.
* @param fnc The func
* @param fbk The fallback
* @param flw The follow up func
* @since 0.12
*/
public FuncWithFallback(final Proc<X> fnc,
final Func<Throwable, Y> fbk, final Proc<Y> flw) {
this(new FuncOf<>(fnc), fbk, flw);
}

/**
* Ctor.
* @param fnc The func
* @param fbk The fallback
* @param flw The follow up func
* @since 0.12
*/
public FuncWithFallback(final Callable<Y> fnc,
final Func<Throwable, Y> fbk, final Func<Y, Y> flw) {
this(new FuncOf<>(fnc), fbk, flw);
}

/**
* Ctor.
* @param fnc The func
* @param fbk The fallback
* @param flw The follow up func
* @since 0.12
*/
public FuncWithFallback(final Callable<Y> fnc,
final Proc<Throwable> fbk, final Func<Y, Y> flw) {
this(new FuncOf<>(fnc), fbk, flw);
}

/**
* Ctor.
* @param fnc The func
* @param fbk The fallback
* @param flw The follow up func
* @since 0.12
*/
public FuncWithFallback(final Callable<Y> fnc,
final Proc<Throwable> fbk, final Proc<Y> flw) {
this(new FuncOf<>(fnc), fbk, flw);
}

/**
* Ctor.
* @param fnc The func
* @param fbk The fallback
* @param flw The follow up func
* @since 0.12
*/
public FuncWithFallback(final Callable<Y> fnc,
final Func<Throwable, Y> fbk, final Proc<Y> flw) {
this(new FuncOf<>(fnc), fbk, flw);
}

/**
* Ctor.
* @param fnc The func
* @param fbk The fallback
* @param flw The follow up func
* @since 0.12
*/
public FuncWithFallback(final Runnable fnc,
final Func<Throwable, Y> fbk, final Proc<Y> flw) {
this(new FuncOf<>(fnc), fbk, flw);
}

/**
* Ctor.
* @param fnc The func
* @param fbk The fallback
* @param flw The follow up func
* @since 0.12
*/
public FuncWithFallback(final Runnable fnc,
final Func<Throwable, Y> fbk, final Func<Y, Y> flw) {
this(new FuncOf<>(fnc), fbk, flw);
}

/**
* Ctor.
* @param fnc The func
* @param fbk The fallback
* @param flw The follow up func
* @since 0.12
*/
public FuncWithFallback(final Runnable fnc,
final Proc<Throwable> fbk, final Func<Y, Y> flw) {
this(new FuncOf<>(fnc), fbk, flw);
}

/**
* Ctor.
* @param fnc The func
* @param fbk The fallback
* @param flw The follow up func
* @since 0.12
*/
public FuncWithFallback(final Runnable fnc,
final Proc<Throwable> fbk, final Proc<Y> flw) {
this(new FuncOf<>(fnc), fbk, flw);
}

/**
* Ctor.
* @param fnc The func
Expand Down
5 changes: 2 additions & 3 deletions src/test/java/org/cactoos/func/FuncWithFallbackTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import java.io.IOException;
import org.cactoos.FuncApplies;
import org.cactoos.Proc;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
Expand Down Expand Up @@ -53,11 +52,11 @@ public void usesMainFunc() throws Exception {
}

@Test
public void usesCallback() throws Exception {
public void usesFallback() throws Exception {
MatcherAssert.assertThat(
"Can't use the callback in case of exception",
new FuncWithFallback<>(
(Proc<Integer>) input -> {
input -> {
throw new IOException("Failure");
},
ex -> "Never mind"
Expand Down

0 comments on commit 2c9ef05

Please sign in to comment.