BAEL-5253 moving the tests to other module

This commit is contained in:
Matea Pejčinović
2021-11-28 18:03:38 +01:00
parent 1a8c7e71a6
commit 12baca5a20
4 changed files with 8 additions and 78 deletions

View File

@@ -0,0 +1,32 @@
package com.baeldung.isuppercase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import com.google.common.base.Ascii;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.matchesPattern;
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class StringFirstCharacterUppercase {
@Test
public void givenString_whenCheckingWithCharacterIsUpperCase_thenStringCapitalized() {
String example = "Katie";
Assertions.assertTrue(Character.isUpperCase(example.charAt(0)));
}
@Test
public void givenString_whenCheckingWithRegex_thenStringCapitalized() {
String example = "Katie";
String regEx = "[A-Z]\\w*";
assertThat(example, matchesPattern(regEx));
}
@Test
public void givenString_whenCheckingWithGuava_thenStringCapitalized() {
String example = "Katie";
Assertions.assertTrue(Ascii.isUpperCase(example.charAt(0)));
}
}