Skip to content

Commit

Permalink
Hidden non-api objects. Refactoring. Removed Of suffix for <mutators>…
Browse files Browse the repository at this point in the history
…. LengthOf.
  • Loading branch information
ixmanuel committed Jul 30, 2017
1 parent 83342d2 commit 9706ff8
Show file tree
Hide file tree
Showing 16 changed files with 58 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.cactoos.text;
package org.cactoos.func;

import java.io.IOException;
import org.cactoos.Scalar;
import org.cactoos.Text;
import org.cactoos.text.TextOf;

/**
* Text as {@link Boolean}.
Expand All @@ -36,7 +37,7 @@
* @version $Id$
* @since 0.2
*/
public final class TextAsBool implements Scalar<Boolean> {
public final class BoolOf implements Scalar<Boolean> {

/**
* Source text.
Expand All @@ -48,7 +49,7 @@ public final class TextAsBool implements Scalar<Boolean> {
*
* @param string True or false string
*/
public TextAsBool(final String string) {
public BoolOf(final String string) {
this(new TextOf(string));
}

Expand All @@ -57,7 +58,7 @@ public TextAsBool(final String string) {
*
* @param text True or false text
*/
public TextAsBool(final Text text) {
public BoolOf(final Text text) {
this.text = text;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.cactoos.text;
package org.cactoos.func;

import java.io.IOException;
import org.cactoos.Scalar;
import org.cactoos.Text;
import org.cactoos.text.TextOf;

/**
* Text as {@link Double}.
Expand All @@ -36,7 +37,7 @@
* @version $Id$
* @since 0.2
*/
public final class TextAsDouble implements Scalar<Double> {
public final class DoubleOf implements Scalar<Double> {

/**
* Source text.
Expand All @@ -48,7 +49,7 @@ public final class TextAsDouble implements Scalar<Double> {
*
* @param string Number-string
*/
public TextAsDouble(final String string) {
public DoubleOf(final String string) {
this(new TextOf(string));
}

Expand All @@ -57,7 +58,7 @@ public TextAsDouble(final String string) {
*
* @param text Number-text
*/
public TextAsDouble(final Text text) {
public DoubleOf(final Text text) {
this.text = text;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.cactoos.text;
package org.cactoos.func;

import java.io.IOException;
import org.cactoos.Scalar;
import org.cactoos.Text;
import org.cactoos.text.TextOf;

/**
* Text as {@link Float}.
Expand All @@ -36,7 +37,7 @@
* @version $Id$
* @since 0.2
*/
public final class TextAsFloat implements Scalar<Float> {
public final class FloatOf implements Scalar<Float> {

/**
* Source text.
Expand All @@ -48,7 +49,7 @@ public final class TextAsFloat implements Scalar<Float> {
*
* @param string Number-string
*/
public TextAsFloat(final String string) {
public FloatOf(final String string) {
this(new TextOf(string));
}

Expand All @@ -57,7 +58,7 @@ public TextAsFloat(final String string) {
*
* @param text Number-text
*/
public TextAsFloat(final Text text) {
public FloatOf(final Text text) {
this.text = text;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.cactoos.text;
package org.cactoos.func;

import java.io.IOException;
import org.cactoos.Scalar;
import org.cactoos.Text;
import org.cactoos.text.TextOf;

/**
* Text as {@link Integer}.
Expand All @@ -36,7 +37,7 @@
* @version $Id$
* @since 0.2
*/
public final class TextAsInt implements Scalar<Integer> {
public final class IntOf implements Scalar<Integer> {

/**
* Source text.
Expand All @@ -48,7 +49,7 @@ public final class TextAsInt implements Scalar<Integer> {
*
* @param string Number-string
*/
public TextAsInt(final String string) {
public IntOf(final String string) {
this(new TextOf(string));
}

Expand All @@ -57,7 +58,7 @@ public TextAsInt(final String string) {
*
* @param text Number-text
*/
public TextAsInt(final Text text) {
public IntOf(final Text text) {
this.text = text;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.cactoos.text;
package org.cactoos.func;

import java.io.IOException;
import org.cactoos.Scalar;
import org.cactoos.Text;
import org.cactoos.text.TextOf;

/**
* Text as {@link Long}.
Expand All @@ -36,7 +37,7 @@
* @version $Id$
* @since 0.2
*/
public final class TextAsLong implements Scalar<Long> {
public final class LongOf implements Scalar<Long> {

/**
* Source text.
Expand All @@ -48,7 +49,7 @@ public final class TextAsLong implements Scalar<Long> {
*
* @param string Number-string
*/
public TextAsLong(final String string) {
public LongOf(final String string) {
this(new TextOf(string));
}

Expand All @@ -57,7 +58,7 @@ public TextAsLong(final String string) {
*
* @param text Number-text
*/
public TextAsLong(final Text text) {
public LongOf(final Text text) {
this.text = text;
}

Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/cactoos/io/DeadInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.io.IOException;
import java.io.InputStream;
import org.cactoos.Input;
import org.cactoos.text.EmptyBytes;

/**
* Input with no data.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.cactoos.text;
package org.cactoos.io;

import java.io.IOException;
import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import org.cactoos.Scalar;
import org.cactoos.Text;
import org.cactoos.text.TextOf;

/**
* URL as String.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.cactoos.text;
package org.cactoos.io;

import org.cactoos.Bytes;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.cactoos.text;
package org.cactoos.io;

import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import org.cactoos.Scalar;
import org.cactoos.Text;
import org.cactoos.text.TextOf;

/**
* String as URL.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,28 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.cactoos.text;
package org.cactoos.func;

import java.io.IOException;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;

/**
* Test case for {@link TextAsBool}.
* Test case for {@link BoolOf}.
*
* @author Kirill ([email protected])
* @version $Id$
* @since 0.2
* @checkstyle JavadocMethodCheck (500 lines)
*/
public final class TextAsBoolTest {
public final class BoolOfTest {

@Test
public void trueTest() throws IOException {
MatcherAssert.assertThat(
"Can't parse 'true' string",
new TextAsBool("true").value(),
new BoolOf("true").value(),
Matchers.equalTo(true)
);
}
Expand All @@ -51,7 +51,7 @@ public void trueTest() throws IOException {
public void falseTest() throws IOException {
MatcherAssert.assertThat(
"Can't parse 'false' string",
new TextAsBool("false").value(),
new BoolOf("false").value(),
Matchers.equalTo(false)
);
}
Expand All @@ -60,7 +60,7 @@ public void falseTest() throws IOException {
public void isFalseIfTextDoesNotRepresentABoolean() throws IOException {
MatcherAssert.assertThat(
"Can't parse a non-boolean string",
new TextAsBool("abc").value(),
new BoolOf("abc").value(),
Matchers.equalTo(false)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,35 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.cactoos.text;
package org.cactoos.func;

import java.io.IOException;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;

/**
* Test case for {@link TextAsDouble}.
* Test case for {@link DoubleOf}.
*
* @author Kirill ([email protected])
* @version $Id$
* @since 0.2
* @checkstyle JavadocMethodCheck (500 lines)
*/
public final class TextAsDoubleTest {
public final class DoubleOfTest {

@Test
public strictfp void numberTest() throws IOException {
MatcherAssert.assertThat(
"Can't parse double number",
new TextAsDouble("185.65156465123").value(),
new DoubleOf("185.65156465123").value(),
// @checkstyle MagicNumber (1 line)
Matchers.equalTo(185.65156465123)
);
}

@Test(expected = NumberFormatException.class)
public void failsIfTextDoesNotRepresentADouble() throws IOException {
new TextAsDouble("abc").value();
new DoubleOf("abc").value();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,35 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.cactoos.text;
package org.cactoos.func;

import java.io.IOException;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;

/**
* Test case for {@link TextAsFloat}.
* Test case for {@link FloatOf}.
*
* @author Kirill ([email protected])
* @version $Id$
* @since 0.2
* @checkstyle JavadocMethodCheck (500 lines)
*/
public final class TextAsFloatTest {
public final class FloatOfTest {

@Test
public strictfp void numberTest() throws IOException {
MatcherAssert.assertThat(
"Can't parse float number",
new TextAsFloat("1656.894").value(),
new FloatOf("1656.894").value(),
// @checkstyle MagicNumber (1 line)
Matchers.equalTo(1656.894F)
);
}

@Test(expected = NumberFormatException.class)
public void failsIfTextDoesNotRepresentAFloat() throws IOException {
new TextAsFloat("abc").value();
new FloatOf("abc").value();
}
}
Loading

0 comments on commit 9706ff8

Please sign in to comment.