mirror of
https://github.com/shekhargulati/strman-java.git
synced 2026-11-25 15:44:05 +00:00
Fixed #10. Added support for isUpperCase function
This commit is contained in:
@@ -493,6 +493,17 @@ public abstract class Strman {
|
|||||||
return append(value.substring(0, index), substr, value.substring(index));
|
return append(value.substring(0, index), substr, value.substring(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies if String is uppercase
|
||||||
|
*
|
||||||
|
* @param value The input String
|
||||||
|
* @return true if String is uppercase false otherwise
|
||||||
|
*/
|
||||||
|
public static boolean isUpperCase(final String value) {
|
||||||
|
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
|
||||||
|
return Objects.equals(value, value.toUpperCase());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verifies if String is lower case
|
* Verifies if String is lower case
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -409,4 +409,17 @@ public class StrmanTest {
|
|||||||
assertThat(isLowerCase("Foo"), equalTo(false));
|
assertThat(isLowerCase("Foo"), equalTo(false));
|
||||||
assertThat(isLowerCase("foobarfooA"), equalTo(false));
|
assertThat(isLowerCase("foobarfooA"), equalTo(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isUpperCase_shouldBeTrueWhenStringIsUpperCase() throws Exception {
|
||||||
|
assertThat(isUpperCase(""), equalTo(true));
|
||||||
|
assertThat(isUpperCase("FOO"), equalTo(true));
|
||||||
|
assertThat(isUpperCase("FOOBARFOO"), equalTo(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isUpperCase_shouldBeFalseWhenStringIsNotUpperCase() throws Exception {
|
||||||
|
assertThat(isUpperCase("Foo"), equalTo(false));
|
||||||
|
assertThat(isUpperCase("foobarfooA"), equalTo(false));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user