BAEL-7178: StringUtils.isBlank() vs String.isEmpty() (#15213)
* adding first test cases * final code
This commit is contained in:
parent
923556ea27
commit
ea7466682b
|
@ -0,0 +1,25 @@
|
|||
package com.baeldung.isemptyvsisblank;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class StringIsEmptyVsIsBlankUnitTest {
|
||||
|
||||
@Test
|
||||
public void givenString_whenCallIsEmpty_thenReturnCorrectValues() {
|
||||
assertFalse("Example text".isEmpty());
|
||||
assertTrue("".isEmpty());
|
||||
assertFalse(" ".isEmpty());
|
||||
assertFalse("\t\n\r\f".isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenString_whenCallStringIsBlank_thenReturnCorrectValues() {
|
||||
assertFalse("Example text".isBlank());
|
||||
assertTrue("".isBlank());
|
||||
assertTrue(" ".isBlank());
|
||||
assertTrue("\t\n\r\f ".isBlank());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue