Skip to content

Commit

Permalink
(#1065) Applied new naming convention in text package
Browse files Browse the repository at this point in the history
  • Loading branch information
igor committed Feb 23, 2019
1 parent da3c4e0 commit 1019a1d
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
*
* @since 0.9
*/
public final class JoinedText extends TextEnvelope {
public final class Joined extends TextEnvelope {

/**
* Ctor.
* @param delimit Delimit among strings
* @param strs Strings to be joined
*/
public JoinedText(final String delimit, final String... strs) {
public Joined(final String delimit, final String... strs) {
this(delimit, new IterableOf<>(strs));
}

Expand All @@ -52,7 +52,7 @@ public JoinedText(final String delimit, final String... strs) {
* @param delimit Delimit among strings
* @param strs Strings to be joined
*/
public JoinedText(final String delimit, final Iterable<String> strs) {
public Joined(final String delimit, final Iterable<String> strs) {
this(
new TextOf(delimit),
new Mapped<>(TextOf::new, strs)
Expand All @@ -64,7 +64,7 @@ public JoinedText(final String delimit, final Iterable<String> strs) {
* @param delimit Delimit among texts
* @param txts Texts to be joined
*/
public JoinedText(final Text delimit, final Text... txts) {
public Joined(final Text delimit, final Text... txts) {
this(delimit, new IterableOf<>(txts));
}

Expand All @@ -73,7 +73,7 @@ public JoinedText(final Text delimit, final Text... txts) {
* @param delimit Delimit among texts
* @param txts Texts to be joined
*/
public JoinedText(final Text delimit, final Iterable<? extends Text> txts) {
public Joined(final Text delimit, final Iterable<? extends Text> txts) {
super((Scalar<String>) () -> {
final StringJoiner joint =
new StringJoiner(delimit.asString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@
*
* @since 0.9
*/
public final class NormalizedText extends TextEnvelope {
public final class Normalized extends TextEnvelope {

/**
* Ctor.
* @param text A Text
*/
public NormalizedText(final String text) {
public Normalized(final String text) {
this(new TextOf(text));
}

/**
* Ctor.
* @param text A Text
*/
public NormalizedText(final Text text) {
public Normalized(final Text text) {
super(
(Scalar<String>) () -> new Replaced(
new TrimmedText(text),
new Trimmed(text),
"\\s+",
" "
).asString()
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/cactoos/text/PaddedStartText.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public PaddedStartText(
final Text text, final int length, final char symbol) {
super((Scalar<String>) () -> {
final String original = text.asString();
return new JoinedText(
return new Joined(
new TextOf(""),
new Repeated(
new TextOf(symbol), length - original.length()
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/cactoos/text/TextOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ public TextOf(final String input, final Charset cset) {
*/
public TextOf(final Iterable<?> iterable) {
this(
() -> new JoinedText(
() -> new Joined(
", ",
new Mapped<>(
Object::toString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*
* @since 0.1
*/
public final class TrimmedText implements Text {
public final class Trimmed implements Text {

/**
* The text.
Expand All @@ -43,7 +43,7 @@ public final class TrimmedText implements Text {
* Ctor.
* @param text The text
*/
public TrimmedText(final Text text) {
public Trimmed(final Text text) {
this.origin = text;
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/cactoos/text/package-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
* Text.
*
* @since 0.1
* @todo #1005:30min Continue applying the new class naming convention:
* avoid compound names for decorators. Continue renaming classes implementing
* the {@link org.cactoos.Text}. More details you can find here
* @todo #1065:30min Continue applying the new class naming convention:
* avoid compound names for decorators. Continue renaming of classes
* implementing the {@link org.cactoos.Text}. More details you can find here
* https://github.com/yegor256/cactoos/issues/913#issuecomment-402332247.
*/
package org.cactoos.text;
6 changes: 3 additions & 3 deletions src/test/java/org/cactoos/io/BytesOfTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.cactoos.Text;
import org.cactoos.iterable.Endless;
import org.cactoos.iterable.HeadOf;
import org.cactoos.text.JoinedText;
import org.cactoos.text.Joined;
import org.cactoos.text.TextOf;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
Expand All @@ -57,7 +57,7 @@ public void readsLargeInMemoryContent() throws Exception {
"Can't read large content from in-memory Input",
new BytesOf(
new InputOf(
new JoinedText(
new Joined(
"",
new HeadOf<>(
multiplier, new Endless<>(body)
Expand Down Expand Up @@ -181,7 +181,7 @@ public void printsStackTrace() {
)
),
new TextHasString(
new JoinedText(
new Joined(
System.lineSeparator(),
"java.io.IOException: It doesn't work at all",
"\tat org.cactoos.io.BytesOfTest"
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/cactoos/io/FakeHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import java.util.List;
import java.util.logging.Handler;
import java.util.logging.LogRecord;
import org.cactoos.text.JoinedText;
import org.cactoos.text.Joined;
import org.cactoos.text.UncheckedText;

/**
Expand Down Expand Up @@ -64,7 +64,7 @@ public void flush() {
@Override
public String toString() {
return new UncheckedText(
new JoinedText(
new Joined(
System.lineSeparator(),
this.entries
)
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/cactoos/iterable/ReversedTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
package org.cactoos.iterable;

import org.cactoos.text.JoinedText;
import org.cactoos.text.Joined;
import org.hamcrest.MatcherAssert;
import org.junit.Test;
import org.llorllale.cactoos.matchers.TextHasString;
Expand All @@ -39,7 +39,7 @@ public final class ReversedTest {
public void reversesIterable() {
MatcherAssert.assertThat(
"Can't reverse an iterable",
new JoinedText(
new Joined(
" ",
new Reversed<>(
new IterableOf<>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@
import org.llorllale.cactoos.matchers.TextHasString;

/**
* Test case for {@link JoinedText}.
* Test case for {@link Joined}.
* @since 0.9
* @checkstyle JavadocMethodCheck (500 lines)
*/
public final class JoinedTextTest {
public final class JoinedTest {

@Test
public void joinsStrings() throws IOException {
MatcherAssert.assertThat(
"Can't join strings",
new JoinedText(" ", "hello", "world"),
new Joined(" ", "hello", "world"),
new TextHasString("hello world")
);
}
Expand All @@ -48,7 +48,7 @@ public void joinsStrings() throws IOException {
public void joinsTexts() throws IOException {
MatcherAssert.assertThat(
"Can't join texts",
new JoinedText(
new Joined(
new TextOf(" "),
new TextOf("foo"),
new TextOf("bar")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@
import org.llorllale.cactoos.matchers.TextHasString;

/**
* Test case for {@link NormalizedText}.
* Test case for {@link Normalized}.
* @since 0.9
* @checkstyle JavadocMethodCheck (500 lines)
*/
public final class NormalizedTextTest {
public final class NormalizedTest {

@Test
public void normalizesText() throws IOException {
MatcherAssert.assertThat(
"Can't normalize a text",
new NormalizedText(" \t hello \t\tworld \t"),
new Normalized(" \t hello \t\tworld \t"),
new TextHasString("hello world")
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/cactoos/text/TextEnvelopeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ public void testEquals() {
/**
* Test for {@link TextEnvelope#equals(Object)} method. Must assert
* that the envelope value is equal another text representing the same
* value (in this case a {@link JoinedText}).
* value (in this case a {@link Joined}).
*/
@Test
public void testEqualsOtherText() {
MatcherAssert.assertThat(
"Envelope does not match another text representing the same value",
new TextEnvelopeDummy("isequaltoanothertext"),
new IsEqual<>(
new JoinedText("", "is", "equal", "to", "another", "text")
new Joined("", "is", "equal", "to", "another", "text")
)
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/cactoos/text/TextOfTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public void printsStackTrace() {
)
),
new TextHasString(
new JoinedText(
new Joined(
System.lineSeparator(),
"java.io.IOException: It doesn't work at all",
"\tat org.cactoos.text.TextOfTest"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@
import org.llorllale.cactoos.matchers.TextHasString;

/**
* Test case for {@link TrimmedText}.
* Test case for {@link Trimmed}.
* @since 0.1
* @checkstyle JavadocMethodCheck (500 lines)
*/
public final class TrimmedTextTest {
public final class TrimmedTest {

@Test
public void convertsText() {
MatcherAssert.assertThat(
"Can't trim a text",
new TrimmedText(new TextOf(" Hello! \t ")),
new Trimmed(new TextOf(" Hello! \t ")),
new TextHasString("Hello!")
);
}
Expand All @@ -47,7 +47,7 @@ public void convertsText() {
public void trimmedBlankTextIsEmptyText() {
MatcherAssert.assertThat(
"Can't trim a blank text",
new TrimmedText(new TextOf(" \t ")),
new Trimmed(new TextOf(" \t ")),
new TextHasString("")
);
}
Expand Down

0 comments on commit 1019a1d

Please sign in to comment.