This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-lang.git
The following commit(s) were added to refs/heads/master by this push: new 1f06eb4 Refactor some test fixtures. 1f06eb4 is described below commit 1f06eb4dceca711641d1930e02a3a8cae2f25258 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sat Nov 20 09:42:57 2021 -0500 Refactor some test fixtures. --- .../commons/lang3/StringUtilsContainsTest.java | 26 ++---------- .../lang3/StringUtilsEqualsIndexOfTest.java | 13 ++---- .../org/apache/commons/lang3/Supplementary.java | 49 ++++++++++++++++++++++ 3 files changed, 56 insertions(+), 32 deletions(-) diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsContainsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsContainsTest.java index 0f02375..1d9f724 100644 --- a/src/test/java/org/apache/commons/lang3/StringUtilsContainsTest.java +++ b/src/test/java/org/apache/commons/lang3/StringUtilsContainsTest.java @@ -16,6 +16,10 @@ */ package org.apache.commons.lang3; +import static org.apache.commons.lang3.Supplementary.CharU20000; +import static org.apache.commons.lang3.Supplementary.CharU20001; +import static org.apache.commons.lang3.Supplementary.CharUSuppCharHigh; +import static org.apache.commons.lang3.Supplementary.CharUSuppCharLow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -29,28 +33,6 @@ import org.junitpioneer.jupiter.DefaultLocale; * Unit tests {@link org.apache.commons.lang3.StringUtils} - Contains methods */ public class StringUtilsContainsTest { - /** - * Supplementary character U+20000 - * See http://www.oracle.com/technetwork/articles/javase/supplementary-142654.html - */ - private static final String CharU20000 = "\uD840\uDC00"; - /** - * Supplementary character U+20001 - * See http://www.oracle.com/technetwork/articles/javase/supplementary-142654.html - */ - private static final String CharU20001 = "\uD840\uDC01"; - /** - * Incomplete supplementary character U+20000, high surrogate only. - * See http://www.oracle.com/technetwork/articles/javase/supplementary-142654.html - */ - private static final String CharUSuppCharHigh = "\uDC00"; - - /** - * Incomplete supplementary character U+20000, low surrogate only. - * See http://www.oracle.com/technetwork/articles/javase/supplementary-142654.html - */ - private static final String CharUSuppCharLow = "\uD840"; - @Test public void testContains_Char() { assertFalse(StringUtils.contains(null, ' ')); diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java index 86f8702..51a7d45 100644 --- a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java +++ b/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java @@ -16,6 +16,8 @@ */ package org.apache.commons.lang3; +import static org.apache.commons.lang3.Supplementary.CharU20000; +import static org.apache.commons.lang3.Supplementary.CharU20001; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -31,17 +33,8 @@ import org.junit.jupiter.api.Test; * Unit tests {@link org.apache.commons.lang3.StringUtils} - Equals/IndexOf methods */ public class StringUtilsEqualsIndexOfTest { + private static final String BAR = "bar"; - /** - * Supplementary character U+20000 - * See http://www.oracle.com/technetwork/articles/javase/supplementary-142654.html - */ - private static final String CharU20000 = "\uD840\uDC00"; - /** - * Supplementary character U+20001 - * See http://www.oracle.com/technetwork/articles/javase/supplementary-142654.html - */ - private static final String CharU20001 = "\uD840\uDC01"; private static final String FOO = "foo"; diff --git a/src/test/java/org/apache/commons/lang3/Supplementary.java b/src/test/java/org/apache/commons/lang3/Supplementary.java new file mode 100644 index 0000000..97d4118 --- /dev/null +++ b/src/test/java/org/apache/commons/lang3/Supplementary.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3; + +/** + * Supplementary character test fixtures. + * + * See http://www.oracle.com/technetwork/articles/javase/supplementary-142654.html + */ +public class Supplementary { + + /** + * Supplementary character U+20000 See http://www.oracle.com/technetwork/articles/javase/supplementary-142654.html + */ + static final String CharU20000 = "\uD840\uDC00"; + + /** + * Supplementary character U+20001 See http://www.oracle.com/technetwork/articles/javase/supplementary-142654.html + */ + static final String CharU20001 = "\uD840\uDC01"; + + /** + * Incomplete supplementary character U+20000, high surrogate only. See + * http://www.oracle.com/technetwork/articles/javase/supplementary-142654.html + */ + static final String CharUSuppCharHigh = "\uDC00"; + + /** + * Incomplete supplementary character U+20000, low surrogate only. See + * http://www.oracle.com/technetwork/articles/javase/supplementary-142654.html + */ + static final String CharUSuppCharLow = "\uD840"; + +}