You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/11/03 15:57:34 UTC
(commons-text) 01/02: Normalize test method names
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-text.git
commit c67fa0b6e9f68fecaf9cedeade816d05d20e4d08
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Nov 3 11:53:07 2023 -0400
Normalize test method names
---
.../apache/commons/text/AlphabetConverterTest.java | 24 +++++++++++-----------
.../commons/text/translate/CsvTranslatorsTest.java | 20 +++++++++---------
.../text/translate/SinglePassTranslatorTest.java | 4 ++--
3 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/src/test/java/org/apache/commons/text/AlphabetConverterTest.java b/src/test/java/org/apache/commons/text/AlphabetConverterTest.java
index fcab45e0..b0dac3a7 100644
--- a/src/test/java/org/apache/commons/text/AlphabetConverterTest.java
+++ b/src/test/java/org/apache/commons/text/AlphabetConverterTest.java
@@ -61,7 +61,7 @@ public class AlphabetConverterTest {
private static final Integer[] DO_NOT_ENCODE_CODEPOINTS = {32, 97, 98, 99}; // space, a, b, c
@Test
- public void binaryTest() throws UnsupportedEncodingException {
+ public void testBinaryTest() throws UnsupportedEncodingException {
test(BINARY, NUMBERS, ArrayUtils.EMPTY_CHARACTER_OBJECT_ARRAY, "0", "1", "10", "11");
test(NUMBERS, BINARY, ArrayUtils.EMPTY_CHARACTER_OBJECT_ARRAY, "12345", "0");
test(LOWER_CASE_ENGLISH, BINARY, ArrayUtils.EMPTY_CHARACTER_OBJECT_ARRAY, "abc", "a");
@@ -76,19 +76,19 @@ public class AlphabetConverterTest {
}
@Test
- public void doNotEncodeTest() throws UnsupportedEncodingException {
+ public void testDoNotEncodeTest() throws UnsupportedEncodingException {
test(ENGLISH_AND_NUMBERS, LOWER_CASE_ENGLISH_AND_NUMBERS, LOWER_CASE_ENGLISH, "1", "456", "abc", "ABC", "this will not be converted but THIS WILL");
test(ENGLISH_AND_NUMBERS, LOWER_CASE_ENGLISH_AND_NUMBERS, NUMBERS, "1", "456", "abc", "ABC", "this will be converted but 12345 and this will be");
}
@Test
- public void encodeFailureTest() {
+ public void testEncodeFailureTest() {
assertThatThrownBy(() -> test(BINARY, NUMBERS, ArrayUtils.EMPTY_CHARACTER_OBJECT_ARRAY, "3")).isInstanceOf(UnsupportedEncodingException.class)
.hasMessage("Couldn't find encoding for '3' in 3");
}
@Test
- public void hebrewTest() throws UnsupportedEncodingException {
+ public void testHebrewTest() throws UnsupportedEncodingException {
test(HEBREW, BINARY, ArrayUtils.EMPTY_CHARACTER_OBJECT_ARRAY, "\u05d0", "\u05e2",
"\u05d0\u05dc\u05e3_\u05d0\u05d5\u05d4\u05d1\u05dc_\u05d1\u05d9\u05ea_\u05d6\u05d4_\u05d1\u05d9\u05ea_"
+ "\u05d2\u05d9\u05de\u05dc_\u05d6\u05d4_\u05db\u05de\u05dc_\u05d2\u05d3\u05d5\u05dc");
@@ -103,7 +103,7 @@ public class AlphabetConverterTest {
* Test example in javadocs for consistency
*/
@Test
- public void javadocExampleTest() throws UnsupportedEncodingException {
+ public void testJavadocExampleTest() throws UnsupportedEncodingException {
final AlphabetConverter ac = createJavadocExample();
assertThat(ac.encode("a")).isEqualTo("00");
@@ -114,25 +114,25 @@ public class AlphabetConverterTest {
}
@Test
- public void missingDoNotEncodeLettersFromEncodingTest() {
+ public void testMissingDoNotEncodeLettersFromEncodingTest() {
assertThatThrownBy(() -> AlphabetConverter.createConverterFromChars(ENGLISH_AND_NUMBERS, LOWER_CASE_ENGLISH, NUMBERS))
.isInstanceOf(IllegalArgumentException.class).hasMessage("Can not use 'do not encode' list because encoding alphabet does not contain '0'");
}
@Test
- public void missingDoNotEncodeLettersFromOriginalTest() {
+ public void testMissingDoNotEncodeLettersFromOriginalTest() {
assertThatThrownBy(() -> AlphabetConverter.createConverterFromChars(LOWER_CASE_ENGLISH, ENGLISH_AND_NUMBERS, NUMBERS))
.isInstanceOf(IllegalArgumentException.class).hasMessage("Can not use 'do not encode' list because original alphabet does not contain '0'");
}
@Test
- public void noEncodingLettersTest() {
+ public void testNoEncodingLettersTest() {
assertThatThrownBy(() -> AlphabetConverter.createConverterFromChars(ENGLISH_AND_NUMBERS, NUMBERS, NUMBERS)).isInstanceOf(IllegalArgumentException.class)
.hasMessage("Must have at least two encoding characters (excluding those in the 'do not encode' list), but has 0");
}
@Test
- public void onlyOneEncodingLettersTest() {
+ public void testOnlyOneEncodingLettersTest() {
assertThatThrownBy(() -> {
final Character[] numbersPlusUnderscore = Arrays.copyOf(NUMBERS, NUMBERS.length + 1);
numbersPlusUnderscore[numbersPlusUnderscore.length - 1] = '_';
@@ -264,7 +264,7 @@ public class AlphabetConverterTest {
}
@Test
- public void unexpectedEndWhileDecodingTest() {
+ public void testUnexpectedEndWhileDecodingTest() {
final String toDecode = "00d01d0";
assertThatThrownBy(() -> {
final AlphabetConverter ac = createJavadocExample();
@@ -273,7 +273,7 @@ public class AlphabetConverterTest {
}
@Test
- public void unexpectedStringWhileDecodingTest() {
+ public void testUnexpectedStringWhileDecodingTest() {
final String toDecode = "00XX";
assertThatThrownBy(() -> {
final AlphabetConverter ac = createJavadocExample();
@@ -285,7 +285,7 @@ public class AlphabetConverterTest {
* Test constructor from code points
*/
@Test
- public void unicodeTest() throws UnsupportedEncodingException {
+ public void testUnicodeTest() throws UnsupportedEncodingException {
final AlphabetConverter ac = AlphabetConverter.createConverter(UNICODE, LOWER_CASE_ENGLISH_CODEPOINTS, DO_NOT_ENCODE_CODEPOINTS);
assertThat(ac.getEncodedCharLength()).isEqualTo(2);
diff --git a/src/test/java/org/apache/commons/text/translate/CsvTranslatorsTest.java b/src/test/java/org/apache/commons/text/translate/CsvTranslatorsTest.java
index 49b1db7b..bf86136c 100644
--- a/src/test/java/org/apache/commons/text/translate/CsvTranslatorsTest.java
+++ b/src/test/java/org/apache/commons/text/translate/CsvTranslatorsTest.java
@@ -28,7 +28,7 @@ import org.junit.jupiter.api.Test;
public class CsvTranslatorsTest {
@Test
- public void csvEscaperCommaTest() throws IOException {
+ public void testCsvEscaperCommaTest() throws IOException {
final CsvTranslators.CsvEscaper escaper = new CsvTranslators.CsvEscaper();
final Writer writer = new StringWriter();
final String input = "hi,this,is,a,test";
@@ -38,7 +38,7 @@ public class CsvTranslatorsTest {
}
@Test
- public void csvEscaperCRTest() throws IOException {
+ public void testCsvEscaperCRTest() throws IOException {
final CsvTranslators.CsvEscaper escaper = new CsvTranslators.CsvEscaper();
final Writer writer = new StringWriter();
final String input = "hi,this,is,a,CR,test" + String.valueOf(CharUtils.CR);
@@ -48,7 +48,7 @@ public class CsvTranslatorsTest {
}
@Test
- public void csvEscaperLFTest() throws IOException {
+ public void testCsvEscaperLFTest() throws IOException {
final CsvTranslators.CsvEscaper escaper = new CsvTranslators.CsvEscaper();
final Writer writer = new StringWriter();
final String input = "hi,this,is,a,LF,test" + String.valueOf(CharUtils.LF);
@@ -58,7 +58,7 @@ public class CsvTranslatorsTest {
}
@Test
- public void csvEscaperPlaneTextTest() throws IOException {
+ public void testCsvEscaperPlaneTextTest() throws IOException {
final CsvTranslators.CsvEscaper escaper = new CsvTranslators.CsvEscaper();
final Writer writer = new StringWriter();
final String input = "hi this is just a plane text nothing to do with csv!";
@@ -68,7 +68,7 @@ public class CsvTranslatorsTest {
}
@Test
- public void csvEscaperQuoteTest() throws IOException {
+ public void testCsvEscaperQuoteTest() throws IOException {
final CsvTranslators.CsvEscaper escaper = new CsvTranslators.CsvEscaper();
final Writer writer = new StringWriter();
final String input = "hi,this,is,a,\"quote,test";
@@ -78,7 +78,7 @@ public class CsvTranslatorsTest {
}
@Test
- public void csvUnEscaperPlaneTextTest() throws IOException {
+ public void testCsvUnEscaperPlaneTextTest() throws IOException {
final CsvTranslators.CsvUnescaper escaper = new CsvTranslators.CsvUnescaper();
final Writer writer = new StringWriter();
final String input = "hi,this,is,unescape,test";
@@ -88,7 +88,7 @@ public class CsvTranslatorsTest {
}
@Test
- public void csvUnEscaperTest1() throws IOException {
+ public void testCsvUnEscaperTest1() throws IOException {
final CsvTranslators.CsvUnescaper escaper = new CsvTranslators.CsvUnescaper();
final Writer writer = new StringWriter();
final String input = "\"hi,this,is,unescape,test\"";
@@ -98,7 +98,7 @@ public class CsvTranslatorsTest {
}
@Test
- public void csvUnEscaperTest2() throws IOException {
+ public void testCsvUnEscaperTest2() throws IOException {
final CsvTranslators.CsvUnescaper escaper = new CsvTranslators.CsvUnescaper();
final Writer writer = new StringWriter();
final String input = "\"hi,this,is,unescape,test";
@@ -108,7 +108,7 @@ public class CsvTranslatorsTest {
}
@Test
- public void csvUnEscaperTest3() throws IOException {
+ public void testCsvUnEscaperTest3() throws IOException {
final CsvTranslators.CsvUnescaper escaper = new CsvTranslators.CsvUnescaper();
final Writer writer = new StringWriter();
final String input = "hi,this,is,unescape,test\"";
@@ -118,7 +118,7 @@ public class CsvTranslatorsTest {
}
@Test
- public void csvUnEscaperTest4() throws IOException {
+ public void testCsvUnEscaperTest4() throws IOException {
final CsvTranslators.CsvUnescaper escaper = new CsvTranslators.CsvUnescaper();
final Writer writer = new StringWriter();
final String input = "\"hi,this,is,\"unescape,test\"";
diff --git a/src/test/java/org/apache/commons/text/translate/SinglePassTranslatorTest.java b/src/test/java/org/apache/commons/text/translate/SinglePassTranslatorTest.java
index 3d2b1192..f6ca1c34 100644
--- a/src/test/java/org/apache/commons/text/translate/SinglePassTranslatorTest.java
+++ b/src/test/java/org/apache/commons/text/translate/SinglePassTranslatorTest.java
@@ -47,14 +47,14 @@ public class SinglePassTranslatorTest {
}
@Test
- public void codePointsAreReturned() throws Exception {
+ public void testCodePointsAreReturned() throws Exception {
assertThat(dummyTranslator.translate("", 0, out)).isEqualTo(0);
assertThat(dummyTranslator.translate("abc", 0, out)).isEqualTo(3);
assertThat(dummyTranslator.translate("abcdefg", 0, out)).isEqualTo(7);
}
@Test
- public void indexIsValidated() {
+ public void testIndexIsValidated() {
assertThatIllegalArgumentException().isThrownBy(() -> dummyTranslator.translate("abc", 1, out));
}