Make tests a little more bullet-proof.

This commit is contained in:
Gary Gregory 2017-10-09 14:53:32 -06:00
parent 87eff4c78f
commit 732ea5e94f
1 changed files with 6 additions and 4 deletions

View File

@ -21,6 +21,8 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.util.Locale;
import org.apache.commons.lang3.test.SystemDefaultsSwitch; import org.apache.commons.lang3.test.SystemDefaultsSwitch;
import org.hamcrest.core.IsNot; import org.hamcrest.core.IsNot;
import org.junit.Rule; import org.junit.Rule;
@ -166,7 +168,7 @@ public class StringUtilsEqualsIndexOfTest {
assertFalse(StringUtils.equalsAny(null, FOO, BAR, FOOBAR)); assertFalse(StringUtils.equalsAny(null, FOO, BAR, FOOBAR));
assertFalse(StringUtils.equalsAny(FOO, null, BAR)); assertFalse(StringUtils.equalsAny(FOO, null, BAR));
assertTrue(StringUtils.equalsAny(FOO, BAR, null, "", FOO, BAR)); assertTrue(StringUtils.equalsAny(FOO, BAR, null, "", FOO, BAR));
assertFalse(StringUtils.equalsAny(FOO, FOO.toUpperCase())); assertFalse(StringUtils.equalsAny(FOO, FOO.toUpperCase(Locale.ROOT)));
assertFalse(StringUtils.equalsAny(null, (CharSequence[]) null)); assertFalse(StringUtils.equalsAny(null, (CharSequence[]) null));
assertTrue(StringUtils.equalsAny(FOO, new CustomCharSequence("foo"))); assertTrue(StringUtils.equalsAny(FOO, new CustomCharSequence("foo")));
@ -181,7 +183,7 @@ public class StringUtilsEqualsIndexOfTest {
assertFalse(StringUtils.equalsAnyIgnoreCase(FOO, new String[]{})); assertFalse(StringUtils.equalsAnyIgnoreCase(FOO, new String[]{}));
assertTrue(StringUtils.equalsAnyIgnoreCase(FOO, FOO)); assertTrue(StringUtils.equalsAnyIgnoreCase(FOO, FOO));
assertTrue(StringUtils.equalsAnyIgnoreCase(FOO, FOO.toUpperCase())); assertTrue(StringUtils.equalsAnyIgnoreCase(FOO, FOO.toUpperCase(Locale.ROOT)));
assertTrue(StringUtils.equalsAnyIgnoreCase(FOO, FOO, new String(new char[]{'f', 'o', 'o'}))); assertTrue(StringUtils.equalsAnyIgnoreCase(FOO, FOO, new String(new char[]{'f', 'o', 'o'})));
assertTrue(StringUtils.equalsAnyIgnoreCase(FOO, BAR, new String(new char[]{'f', 'O', 'O'}))); assertTrue(StringUtils.equalsAnyIgnoreCase(FOO, BAR, new String(new char[]{'f', 'O', 'O'})));
assertFalse(StringUtils.equalsAnyIgnoreCase(FOO, BAR)); assertFalse(StringUtils.equalsAnyIgnoreCase(FOO, BAR));
@ -193,8 +195,8 @@ public class StringUtilsEqualsIndexOfTest {
assertTrue(StringUtils.equalsAnyIgnoreCase(null, null, null)); assertTrue(StringUtils.equalsAnyIgnoreCase(null, null, null));
assertFalse(StringUtils.equalsAnyIgnoreCase(null, FOO, BAR, FOOBAR)); assertFalse(StringUtils.equalsAnyIgnoreCase(null, FOO, BAR, FOOBAR));
assertFalse(StringUtils.equalsAnyIgnoreCase(FOO, null, BAR)); assertFalse(StringUtils.equalsAnyIgnoreCase(FOO, null, BAR));
assertTrue(StringUtils.equalsAnyIgnoreCase(FOO, BAR, null, "", FOO.toUpperCase(), BAR)); assertTrue(StringUtils.equalsAnyIgnoreCase(FOO, BAR, null, "", FOO.toUpperCase(Locale.ROOT), BAR));
assertTrue(StringUtils.equalsAnyIgnoreCase(FOO, FOO.toUpperCase())); assertTrue(StringUtils.equalsAnyIgnoreCase(FOO, FOO.toUpperCase(Locale.ROOT)));
assertFalse(StringUtils.equalsAnyIgnoreCase(null, (CharSequence[]) null)); assertFalse(StringUtils.equalsAnyIgnoreCase(null, (CharSequence[]) null));
assertTrue(StringUtils.equalsAnyIgnoreCase(FOO, new CustomCharSequence("fOo"))); assertTrue(StringUtils.equalsAnyIgnoreCase(FOO, new CustomCharSequence("fOo")));