From d13c9cc8108c5aee1845eb6c23a5d2a5c916f5d9 Mon Sep 17 00:00:00 2001 From: George Aristy Date: Fri, 8 Jun 2018 14:59:22 -0400 Subject: [PATCH] (#907) New ctors for LowerText and UpperText --- src/main/java/org/cactoos/text/LowerText.java | 8 ++++++++ src/main/java/org/cactoos/text/UpperText.java | 8 ++++++++ src/test/java/org/cactoos/text/LowerTextTest.java | 8 ++++++++ src/test/java/org/cactoos/text/UpperTextTest.java | 8 ++++++++ 4 files changed, 32 insertions(+) diff --git a/src/main/java/org/cactoos/text/LowerText.java b/src/main/java/org/cactoos/text/LowerText.java index df44de081b..5c991229c4 100644 --- a/src/main/java/org/cactoos/text/LowerText.java +++ b/src/main/java/org/cactoos/text/LowerText.java @@ -36,6 +36,14 @@ */ public final class LowerText extends TextEnvelope { + /** + * Ctor. + * @param text The text + */ + public LowerText(final String text) { + this(new TextOf(text)); + } + /** * Ctor. * @param text The text diff --git a/src/main/java/org/cactoos/text/UpperText.java b/src/main/java/org/cactoos/text/UpperText.java index 7909826f7e..786a11175f 100644 --- a/src/main/java/org/cactoos/text/UpperText.java +++ b/src/main/java/org/cactoos/text/UpperText.java @@ -45,6 +45,14 @@ public final class UpperText implements Text { */ private final Locale locale; + /** + * Ctor. + * @param text The text + */ + public UpperText(final String text) { + this(new TextOf(text)); + } + /** * Ctor. * @param text The text diff --git a/src/test/java/org/cactoos/text/LowerTextTest.java b/src/test/java/org/cactoos/text/LowerTextTest.java index 69d3e4cf9d..601ae28050 100644 --- a/src/test/java/org/cactoos/text/LowerTextTest.java +++ b/src/test/java/org/cactoos/text/LowerTextTest.java @@ -43,4 +43,12 @@ public void convertsText() { ); } + @Test + public void convertsString() { + MatcherAssert.assertThat( + "Can't lower case a string", + new LowerText("WoRLd!"), + new TextHasString("world!") + ); + } } diff --git a/src/test/java/org/cactoos/text/UpperTextTest.java b/src/test/java/org/cactoos/text/UpperTextTest.java index 10f3e84b8f..867b0b52d4 100644 --- a/src/test/java/org/cactoos/text/UpperTextTest.java +++ b/src/test/java/org/cactoos/text/UpperTextTest.java @@ -43,4 +43,12 @@ public void convertsText() { ); } + @Test + public void convertsString() { + MatcherAssert.assertThat( + "Can't upper case a string", + new UpperText("World!"), + new TextHasString("WORLD!") + ); + } }