-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update tests
- Loading branch information
Showing
7 changed files
with
109 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2020, Oath Inc. | ||
// Licensed under the terms of the Apache License 2.0 license. See LICENSE file in Ultrabrew Metrics | ||
// for terms. | ||
package io.ultrabrew.metrics.util; | ||
|
||
public class Strings { | ||
|
||
///CLOVER:OFF | ||
private Strings() { | ||
// static class | ||
} | ||
///CLOVER:ON | ||
|
||
/** | ||
* Whether or not the string is empty or null. | ||
* @param s A string to test. | ||
* @return True if the string is empty or null, false if not. | ||
*/ | ||
public static boolean isNullOrEmpty(String s) { | ||
return s == null || s.isEmpty(); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
core/src/test/java/io/ultrabrew/metrics/util/StringsTest.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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2020, Oath Inc. | ||
// Licensed under the terms of the Apache License 2.0 license. See LICENSE file in Ultrabrew Metrics | ||
// for terms. | ||
package io.ultrabrew.metrics.util; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
public class StringsTest { | ||
|
||
@Test | ||
public void testIsNullOrEmpty() { | ||
assertTrue(Strings.isNullOrEmpty(null)); | ||
assertTrue(Strings.isNullOrEmpty("")); | ||
assertFalse(Strings.isNullOrEmpty("foo")); | ||
} | ||
} |
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
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
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