Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch '__rultor'
  • Loading branch information
rultor committed Feb 26, 2019
2 parents 4c9775b + 6f1be03 commit 4a03806
Show file tree
Hide file tree
Showing 16 changed files with 59 additions and 61 deletions.
6 changes: 3 additions & 3 deletions src/main/java/org/cactoos/io/TempFolder.java
Expand Up @@ -33,7 +33,7 @@
import org.cactoos.Text;
import org.cactoos.scalar.IoCheckedScalar;
import org.cactoos.scalar.StickyScalar;
import org.cactoos.text.JoinedText;
import org.cactoos.text.Joined;
import org.cactoos.text.Randomized;
import org.cactoos.text.TextOf;

Expand All @@ -59,7 +59,7 @@ public final class TempFolder implements Scalar<Path>, Closeable {
*/
public TempFolder() {
this(
new JoinedText(
new Joined(
new TextOf(""),
new TextOf("tmp"),
new Randomized(
Expand Down Expand Up @@ -98,7 +98,7 @@ public TempFolder(final Text path) {
new StickyScalar<>(
() -> Files.createDirectory(
Paths.get(
new JoinedText(
new Joined(
File.separator,
System.getProperty("java.io.tmpdir"),
path.asString()
Expand Down
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
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
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
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
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
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/AppendToTest.java
Expand Up @@ -26,7 +26,7 @@
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.nio.file.NoSuchFileException;
import org.cactoos.text.JoinedText;
import org.cactoos.text.Joined;
import org.cactoos.text.Randomized;
import org.junit.Rule;
import org.junit.Test;
Expand Down Expand Up @@ -83,7 +83,7 @@ public void appendsToFile() throws Exception {
new Assertion<>(
"Does not contain expected text",
() -> new InputOf(source),
new InputHasContent(new JoinedText("", first, second))
new InputHasContent(new Joined("", first, second))
).affirm();
}

Expand All @@ -105,7 +105,7 @@ public void appendsUnicodeToFile() throws Exception {
new Assertion<>(
"Can't find expected unicode text content",
() -> new InputOf(source),
new InputHasContent(new JoinedText("", first, second))
new InputHasContent(new Joined("", first, second))
).affirm();
}
}
6 changes: 3 additions & 3 deletions src/test/java/org/cactoos/io/BytesOfTest.java
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
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
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
Expand Up @@ -23,38 +23,37 @@
*/
package org.cactoos.text;

import java.io.IOException;
import org.hamcrest.MatcherAssert;
import org.junit.Test;
import org.llorllale.cactoos.matchers.Assertion;
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(
public void joinsStrings() {
new Assertion<>(
"Can't join strings",
new JoinedText(" ", "hello", "world"),
() -> new Joined(" ", "hello", "world"),
new TextHasString("hello world")
);
).affirm();
}

@Test
public void joinsTexts() throws IOException {
MatcherAssert.assertThat(
public void joinsTexts() {
new Assertion<>(
"Can't join texts",
new JoinedText(
() -> new Joined(
new TextOf(" "),
new TextOf("foo"),
new TextOf("bar")
),
new TextHasString("foo bar")
);
).affirm();
}

}
Expand Up @@ -23,25 +23,24 @@
*/
package org.cactoos.text;

import java.io.IOException;
import org.hamcrest.MatcherAssert;
import org.junit.Test;
import org.llorllale.cactoos.matchers.Assertion;
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(
public void normalizesText() {
new Assertion<>(
"Can't normalize a text",
new NormalizedText(" \t hello \t\tworld \t"),
() -> new Normalized(" \t hello \t\tworld \t"),
new TextHasString("hello world")
);
).affirm();
}

}
4 changes: 2 additions & 2 deletions src/test/java/org/cactoos/text/TextEnvelopeTest.java
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
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
Expand Up @@ -23,32 +23,32 @@
*/
package org.cactoos.text;

import org.hamcrest.MatcherAssert;
import org.junit.Test;
import org.llorllale.cactoos.matchers.Assertion;
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(
new Assertion<>(
"Can't trim a text",
new TrimmedText(new TextOf(" Hello! \t ")),
() -> new Trimmed(new TextOf(" Hello! \t ")),
new TextHasString("Hello!")
);
).affirm();
}

@Test
public void trimmedBlankTextIsEmptyText() {
MatcherAssert.assertThat(
new Assertion<>(
"Can't trim a blank text",
new TrimmedText(new TextOf(" \t ")),
() -> new Trimmed(new TextOf(" \t ")),
new TextHasString("")
);
).affirm();
}
}

2 comments on commit 4a03806

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on 4a03806 Feb 26, 2019

Choose a reason for hiding this comment

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

Puzzle 1005-7baae0dd disappeared from src/main/java/org/cactoos/text/package-info.java, that's why I closed #1065. 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 4a03806 Feb 26, 2019

Choose a reason for hiding this comment

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

Puzzle 1065-0d09f056 discovered in src/main/java/org/cactoos/text/package-info.java and submitted as #1074. 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.