Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce StringUtils and Preconditions.notBlank(..)
- Loading branch information
Showing
5 changed files
with
55 additions
and
14 deletions.
There are no files selected for viewing
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
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
31 changes: 31 additions & 0 deletions
31
junit-commons/src/main/java/org/junit/gen5/commons/util/StringUtils.java
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,31 @@ | |||
/* | |||
* Copyright 2015 the original author or authors. | |||
* | |||
* All rights reserved. This program and the accompanying materials are | |||
* made available under the terms of the Eclipse Public License v1.0 which | |||
* accompanies this distribution and is available at | |||
* | |||
* http://www.eclipse.org/legal/epl-v10.html | |||
*/ | |||
|
|||
package org.junit.gen5.commons.util; | |||
|
|||
/** | |||
* @author Sam Brannen | |||
* @since 5.0 | |||
*/ | |||
public final class StringUtils { | |||
|
|||
private StringUtils() { | |||
/* no-op */ | |||
} | |||
|
|||
public static boolean isEmpty(CharSequence charSequence) { | |||
return (charSequence == null || charSequence.length() == 0); | |||
} | |||
|
|||
public static boolean isBlank(String str) { | |||
return (str == null || str.trim().length() == 0); | |||
} | |||
|
|||
} |
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
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