BAEL-1579: Renaming custom matcher and handling corner case. (#3928)
This commit is contained in:
+7
-7
@@ -3,7 +3,7 @@ package org.baeldung.hamcrest;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.baeldung.hamcrest.custommatchers.IsDivisibleBy.divisibleBy;
|
||||
import static org.baeldung.hamcrest.custommatchers.IsOnlyNumbers.onlyNumbers;
|
||||
import static org.baeldung.hamcrest.custommatchers.IsOnlyDigits.onlyDigits;
|
||||
import static org.baeldung.hamcrest.custommatchers.IsUppercase.uppercase;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
@@ -12,17 +12,17 @@ import static org.hamcrest.Matchers.not;
|
||||
public class HamcrestCustomUnitTest {
|
||||
|
||||
@Test
|
||||
public final void givenAString_whenIsOnlyNumbers_thenCorrect() {
|
||||
String numbers = "123";
|
||||
public final void givenAString_whenIsOnlyDigits_thenCorrect() {
|
||||
String digits = "123";
|
||||
|
||||
assertThat(numbers, is(onlyNumbers()));
|
||||
assertThat(digits, is(onlyDigits()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public final void givenAString_whenIsNotOnlyNumbers_thenCorrect() {
|
||||
String numbers = "123ABC";
|
||||
public final void givenAString_whenIsNotOnlyDigits_thenCorrect() {
|
||||
String aphanumeric = "123ABC";
|
||||
|
||||
assertThat(numbers, is(not(onlyNumbers())));
|
||||
assertThat(aphanumeric, is(not(onlyDigits())));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user