Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/yegor256/cactoos into zon…
Browse files Browse the repository at this point in the history
…e-id
  • Loading branch information
svendiedrichsen committed Dec 27, 2017
2 parents 8b5cd5c + 2c9ef05 commit ed77721
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

1 comment on commit ed77721

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on ed77721 Dec 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 504-de6e0b21 disappeared from src/test/java/org/cactoos/time/ZonedDateTimeOfTest.java, that's why I closed #505. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

Please sign in to comment.