Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Jan 19, 2019
2 parents 0a88360 + da47aaf commit 36c467a
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/cactoos/func/CheckedBiFunc.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import org.cactoos.BiFunc;
import org.cactoos.Func;
import org.cactoos.scalar.CheckedScalar;
import org.cactoos.scalar.Checked;

/**
* BiFunc that throws exception of specified type.
Expand Down Expand Up @@ -62,7 +62,7 @@ public CheckedBiFunc(final BiFunc<X, Y, Z> original,

@Override
public Z apply(final X first, final Y second) throws E {
return new CheckedScalar<>(
return new Checked<>(
() -> this.origin.apply(first, second),
this.func
).value();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/cactoos/func/CheckedBiProc.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import org.cactoos.BiProc;
import org.cactoos.Func;
import org.cactoos.scalar.CheckedScalar;
import org.cactoos.scalar.Checked;

/**
* BiProc that throws exception of specified type.
Expand Down Expand Up @@ -61,7 +61,7 @@ public CheckedBiProc(final BiProc<X, Y> original,

@Override
public void exec(final X first, final Y second) throws E {
new CheckedScalar<>(
new Checked<>(
() -> {
this.origin.exec(first, second);
return true;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/cactoos/func/CheckedFunc.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
package org.cactoos.func;

import org.cactoos.Func;
import org.cactoos.scalar.CheckedScalar;
import org.cactoos.scalar.Checked;

/**
* Func that throws exception of specified type.
Expand Down Expand Up @@ -60,7 +60,7 @@ public CheckedFunc(final Func<X, Y> original,

@Override
public Y apply(final X input) throws E {
return new CheckedScalar<>(
return new Checked<>(
() -> this.origin.apply(input),
this.func
).value();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/cactoos/func/CheckedProc.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import org.cactoos.Func;
import org.cactoos.Proc;
import org.cactoos.scalar.CheckedScalar;
import org.cactoos.scalar.Checked;

/**
* Proc that throws exception of specified type.
Expand Down Expand Up @@ -58,7 +58,7 @@ public CheckedProc(final Proc<X> original, final Func<Exception, E> fnc) {

@Override
public void exec(final X input) throws E {
new CheckedScalar<>(
new Checked<>(
() -> {
this.origin.exec(input);
return true;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/cactoos/io/CheckedBytes.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import org.cactoos.Bytes;
import org.cactoos.Func;
import org.cactoos.scalar.CheckedScalar;
import org.cactoos.scalar.Checked;

/**
* Bytes that throws exception of specified type.
Expand Down Expand Up @@ -57,7 +57,7 @@ public CheckedBytes(final Bytes orig, final Func<Exception, E> fnc) {

@Override
public byte[] asBytes() throws E {
return new CheckedScalar<>(
return new Checked<>(
this.origin::asBytes,
this.func
).value();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/cactoos/io/CheckedInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import java.io.InputStream;
import org.cactoos.Func;
import org.cactoos.Input;
import org.cactoos.scalar.CheckedScalar;
import org.cactoos.scalar.Checked;

/**
* Input that throws exception of specified type.
Expand Down Expand Up @@ -58,7 +58,7 @@ public CheckedInput(final Input orig, final Func<Exception, E> fnc) {

@Override
public InputStream stream() throws E {
return new CheckedScalar<>(
return new Checked<>(
this.origin::stream,
this.func
).value();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/cactoos/io/CheckedOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import java.io.OutputStream;
import org.cactoos.Func;
import org.cactoos.Output;
import org.cactoos.scalar.CheckedScalar;
import org.cactoos.scalar.Checked;

/**
* Output that throws exception of specified type.
Expand Down Expand Up @@ -58,7 +58,7 @@ public CheckedOutput(final Output orig, final Func<Exception, E> fnc) {

@Override
public OutputStream stream() throws E {
return new CheckedScalar<>(
return new Checked<>(
this.origin::stream,
this.func
).value();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* @param <E> Type of exception
* @since 0.30
*/
public final class CheckedScalar<T, E extends Exception> implements Scalar<T> {
public final class Checked<T, E extends Exception> implements Scalar<T> {

/**
* Function that wraps exception.
Expand All @@ -56,7 +56,7 @@ public final class CheckedScalar<T, E extends Exception> implements Scalar<T> {
* @param scalar Encapsulated scalar
* @param fnc Func that wraps exception
*/
public CheckedScalar(final Scalar<T> scalar,
public Checked(final Scalar<T> scalar,
final Func<Exception, E> fnc) {
this.func = fnc;
this.origin = scalar;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/cactoos/scalar/IoCheckedScalar.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public IoCheckedScalar(final Scalar<T> scalar) {

@Override
public T value() throws IOException {
return new CheckedScalar<>(
return new Checked<>(
this.origin,
IOException::new
).value();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/cactoos/scalar/package-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* Scalars.
*
* @since 0.12
* @todo #980:30min Continue applying the new class naming convention in effect:
* @todo #1007:30min Continue applying the new class naming convention:
* avoid compound names for decorators. Continue renaming classes implementing
* the {@link org.cactoos.Scalar}. More details you can find here
* https://github.com/yegor256/cactoos/issues/913#issuecomment-402332247.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@
import org.junit.Test;

/**
* Test case for {@link CheckedScalar}.
* Test case for {@link Checked}.
* @since 0.30
* @checkstyle JavadocMethodCheck (500 lines)
*/
public final class CheckedScalarTest {
public final class CheckedTest {

@Test(expected = IllegalStateException.class)
public void runtimeExceptionGoesOut() throws Exception {
new CheckedScalar<>(
new Checked<>(
() -> {
throw new IllegalStateException("runtime");
},
Expand All @@ -48,7 +48,7 @@ public void runtimeExceptionGoesOut() throws Exception {

@Test(expected = IOException.class)
public void throwsIoException() throws Exception {
new CheckedScalar<>(
new Checked<>(
() -> {
throw new InterruptedException("interrupt");
},
Expand All @@ -59,7 +59,7 @@ public void throwsIoException() throws Exception {
@Test
public void ioExceptionGoesOut() throws Exception {
try {
new CheckedScalar<>(
new Checked<>(
() -> {
throw new IOException("io");
},
Expand All @@ -76,7 +76,7 @@ public void ioExceptionGoesOut() throws Exception {
@Test
public void fileNotFoundExceptionGoesOut() throws Exception {
try {
new CheckedScalar<>(
new Checked<>(
() -> {
throw new FileNotFoundException("file not found");
},
Expand All @@ -94,7 +94,7 @@ public void fileNotFoundExceptionGoesOut() throws Exception {
public void throwsIoExceptionWithModifiedMessage() throws Exception {
final String message = "error msg";
try {
new CheckedScalar<>(
new Checked<>(
() -> {
throw new IOException("io");
},
Expand Down

2 comments on commit 36c467a

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on 36c467a Jan 19, 2019

Choose a reason for hiding this comment

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

Puzzle 980-ea22ff49 disappeared from src/main/java/org/cactoos/scalar/package-info.java, that's why I closed #1007. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on 36c467a Jan 19, 2019

Choose a reason for hiding this comment

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

Puzzle 1007-e4b38199 discovered in src/main/java/org/cactoos/scalar/package-info.java and submitted as #1025. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

Please sign in to comment.