Last active
May 28, 2019 17:07
-
-
Save d4rken/00237405f5c900a46ad5ae3c753d0d74 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun claresSimpleQuestion(input: String) : Boolean { | |
val pattern = Pattern.compile("^[A-Z].*?$") | |
return pattern.matcher(input).matches() | |
} | |
@Test | |
fun testClaresSimpleQuestion() { | |
assertThat(claresSimpleQuestion(""),`is`(false)) | |
assertThat(claresSimpleQuestion("a"),`is`(false)) | |
assertThat(claresSimpleQuestion("A"),`is`(true)) | |
assertThat(claresSimpleQuestion("Aa"),`is`(true)) | |
assertThat(claresSimpleQuestion("aA"),`is`(false)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun String.test() : Boolean = Pattern.compile("^[A-Z].*?$").matcher(this).matches() | |
assert("Aa".test() && !"aA".test()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment