Search in sources :

Example 1 with StartsWith

use of org.llorllale.cactoos.matchers.StartsWith in project cactoos by yegor256.

the class TextOfTest method readsStringBuilder.

@Test
void readsStringBuilder() {
    final String starts = "Name it, ";
    final String ends = "then it exists!";
    new Assertion<>("Can't process a string builder", new TextOf(new StringBuilder(starts).append(ends)), new AllOf<>(new StartsWith(starts), new EndsWith(ends))).affirm();
}
Also used : HasString(org.llorllale.cactoos.matchers.HasString) StartsWith(org.llorllale.cactoos.matchers.StartsWith) AllOf(org.hamcrest.core.AllOf) EndsWith(org.llorllale.cactoos.matchers.EndsWith) Test(org.junit.jupiter.api.Test)

Example 2 with StartsWith

use of org.llorllale.cactoos.matchers.StartsWith in project cactoos by yegor256.

the class InputOfTest method readsStringBuilder.

@Test
void readsStringBuilder() throws Exception {
    final String starts = "Name it, ";
    final String ends = "then it exists!";
    new Assertion<>("must receive a string builder", new TextOf(new BytesOf(new InputOf(new StringBuilder(starts).append(ends)))), new AllOf<>(new StartsWith(starts), new EndsWith(ends))).affirm();
}
Also used : BytesOf(org.cactoos.bytes.BytesOf) TextOf(org.cactoos.text.TextOf) HasString(org.llorllale.cactoos.matchers.HasString) StartsWith(org.llorllale.cactoos.matchers.StartsWith) AllOf(org.hamcrest.core.AllOf) EndsWith(org.llorllale.cactoos.matchers.EndsWith) Test(org.junit.jupiter.api.Test)

Example 3 with StartsWith

use of org.llorllale.cactoos.matchers.StartsWith in project cactoos by yegor256.

the class InputOfTest method readsStringBuffer.

@Test
void readsStringBuffer() throws Exception {
    final String starts = "The future ";
    final String ends = "is now!";
    new Assertion<>("must receive a string buffer", new TextOf(new BytesOf(new InputOf(new StringBuffer(starts).append(ends)))), new AllOf<>(new StartsWith(starts), new EndsWith(ends))).affirm();
}
Also used : BytesOf(org.cactoos.bytes.BytesOf) TextOf(org.cactoos.text.TextOf) HasString(org.llorllale.cactoos.matchers.HasString) StartsWith(org.llorllale.cactoos.matchers.StartsWith) AllOf(org.hamcrest.core.AllOf) EndsWith(org.llorllale.cactoos.matchers.EndsWith) Test(org.junit.jupiter.api.Test)

Example 4 with StartsWith

use of org.llorllale.cactoos.matchers.StartsWith in project cactoos by yegor256.

the class TextOfTest method readsStringBuffer.

@Test
void readsStringBuffer() {
    final String starts = "In our daily life, ";
    final String ends = "we can smile!";
    new Assertion<>("Can't process a string builder hahahaha", new TextOf(new StringBuffer(starts).append(ends)), new AllOf<>(new StartsWith(starts), new EndsWith(ends))).affirm();
}
Also used : HasString(org.llorllale.cactoos.matchers.HasString) StartsWith(org.llorllale.cactoos.matchers.StartsWith) AllOf(org.hamcrest.core.AllOf) EndsWith(org.llorllale.cactoos.matchers.EndsWith) Test(org.junit.jupiter.api.Test)

Aggregations

AllOf (org.hamcrest.core.AllOf)4 Test (org.junit.jupiter.api.Test)4 EndsWith (org.llorllale.cactoos.matchers.EndsWith)4 HasString (org.llorllale.cactoos.matchers.HasString)4 StartsWith (org.llorllale.cactoos.matchers.StartsWith)4 BytesOf (org.cactoos.bytes.BytesOf)2 TextOf (org.cactoos.text.TextOf)2