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 2012/06/20 21:04:12 UTC
svn commit: r1352268 [5/5] - in /commons/proper/codec/trunk/src:
main/java/org/apache/commons/codec/
main/java/org/apache/commons/codec/binary/
main/java/org/apache/commons/codec/digest/
main/java/org/apache/commons/codec/language/ main/java/org/apache...
Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/digest/DigestUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/digest/DigestUtilsTest.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/digest/DigestUtilsTest.java (original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/digest/DigestUtilsTest.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* 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.
@@ -31,13 +31,13 @@ import org.junit.Test;
/**
* Tests DigestUtils methods.
- *
+ *
* @version $Id$
*/
public class DigestUtilsTest {
private final byte[] testData = new byte[1024*1024];
-
+
private byte[] getBytesUtf8(String hashMe) {
return StringUtils.getBytesUtf8(hashMe);
}
@@ -53,7 +53,7 @@ public class DigestUtilsTest {
public void testConstructable() {
new DigestUtils();
}
-
+
@Test
public void testInternalNoSuchAlgorithmException() {
try {
@@ -126,18 +126,18 @@ public class DigestUtilsTest {
DigestUtils.sha256Hex(getBytesUtf8("abc")));
assertEquals("248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1",
DigestUtils.sha256Hex("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"));
-
+
assertEquals(DigestUtils.sha256Hex(testData),
DigestUtils.sha256Hex(new ByteArrayInputStream(testData)));
- }
+ }
@Test
public void testSha384() throws IOException {
// Examples from FIPS 180-2
- assertEquals("cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed" +
+ assertEquals("cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed" +
"8086072ba1e7cc2358baeca134c825a7",
DigestUtils.sha384Hex("abc"));
- assertEquals("cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed" +
+ assertEquals("cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed" +
"8086072ba1e7cc2358baeca134c825a7",
DigestUtils.sha384Hex(getBytesUtf8("abc")));
assertEquals("09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712" +
@@ -157,13 +157,13 @@ public class DigestUtilsTest {
assertEquals("ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a" +
"2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f",
DigestUtils.sha512Hex(getBytesUtf8("abc")));
- assertEquals("8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018" +
+ assertEquals("8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018" +
"501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909",
- DigestUtils.sha512Hex("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn" +
+ DigestUtils.sha512Hex("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn" +
"hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"));
assertEquals(DigestUtils.sha512Hex(testData),
DigestUtils.sha512Hex(new ByteArrayInputStream(testData)));
-}
+}
@Test
public void testShaHex() throws IOException {
@@ -179,7 +179,7 @@ public class DigestUtilsTest {
DigestUtils.shaHex(new ByteArrayInputStream(testData)));
}
-
+
@Test
public void testUpdateWithByteArray(){
final String d1 = "C'est un homme qui rentre dans un café, et plouf";
@@ -202,7 +202,7 @@ public class DigestUtilsTest {
public void testUpdateWithString(){
final String d1 = "C'est un homme qui rentre dans un café, et plouf";
final String d2 = "C'est un homme, c'est qu'une tête, on lui offre un cadeau: 'oh... encore un chapeau!'";
-
+
MessageDigest messageDigest = DigestUtils.getShaDigest();
messageDigest.update(StringUtils.getBytesUtf8(d1));
messageDigest.update(StringUtils.getBytesUtf8(d2));
Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/Caverphone1Test.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/Caverphone1Test.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/Caverphone1Test.java (original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/Caverphone1Test.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* 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.
@@ -26,7 +26,7 @@ import org.junit.Test;
/**
* Tests Caverphone1.
- *
+ *
* @version $Id: CaverphoneTest.java 1075947 2011-03-01 17:56:14Z ggregory $
* @since 1.5
*/
@@ -39,9 +39,9 @@ public class Caverphone1Test extends Str
/**
* Tests example adapted from version 2.0 http://caversham.otago.ac.nz/files/working/ctp150804.pdf
- *
+ *
* AT1111 words: add, aid, at, art, eat, earth, head, hit, hot, hold, hard, heart, it, out, old
- *
+ *
* @throws EncoderException
*/
@Test
@@ -72,7 +72,7 @@ public class Caverphone1Test extends Str
/**
* Tests some examples from version 2.0 http://caversham.otago.ac.nz/files/working/ctp150804.pdf
- *
+ *
* @throws EncoderException
*/
@Test
@@ -84,7 +84,7 @@ public class Caverphone1Test extends Str
/**
* Tests example from http://caversham.otago.ac.nz/files/working/ctp060902.pdf
- *
+ *
* @throws EncoderException
*/
@Test
@@ -95,7 +95,7 @@ public class Caverphone1Test extends Str
/**
* Tests examples from http://en.wikipedia.org/wiki/Caverphone
- *
+ *
* @throws EncoderException
*/
@Test
Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/Caverphone2Test.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/Caverphone2Test.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/Caverphone2Test.java (original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/Caverphone2Test.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* 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.
@@ -26,7 +26,7 @@ import org.junit.Test;
/**
* Tests Caverphone2.
- *
+ *
* @version $Id$
* @since 1.5
*/
@@ -39,9 +39,9 @@ public class Caverphone2Test extends Str
/**
* See http://caversham.otago.ac.nz/files/working/ctp150804.pdf
- *
+ *
* AT11111111 words: add, aid, at, art, eat, earth, head, hit, hot, hold, hard, heart, it, out, old
- *
+ *
* @throws EncoderException
*/
@Test
@@ -66,7 +66,7 @@ public class Caverphone2Test extends Str
/**
* See http://caversham.otago.ac.nz/files/working/ctp150804.pdf
- *
+ *
* @throws EncoderException
*/
@Test
@@ -77,7 +77,7 @@ public class Caverphone2Test extends Str
/**
* See http://caversham.otago.ac.nz/files/working/ctp150804.pdf
- *
+ *
* @throws EncoderException
*/
@Test
@@ -169,7 +169,7 @@ public class Caverphone2Test extends Str
/**
* See http://caversham.otago.ac.nz/files/working/ctp150804.pdf
- *
+ *
* @throws EncoderException
*/
@Test
@@ -248,7 +248,7 @@ public class Caverphone2Test extends Str
/**
* See http://caversham.otago.ac.nz/files/working/ctp150804.pdf
- *
+ *
* @throws EncoderException
*/
@Test
@@ -326,7 +326,7 @@ public class Caverphone2Test extends Str
/**
* See http://caversham.otago.ac.nz/files/working/ctp150804.pdf
- *
+ *
* @throws EncoderException
*/
@Test
Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/ColognePhoneticTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/ColognePhoneticTest.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/ColognePhoneticTest.java (original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/ColognePhoneticTest.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* 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.
@@ -24,9 +24,9 @@ import org.junit.Test;
/**
* Tests the {@code ColognePhonetic} class.
- *
+ *
* <p>Keep this file in UTF-8 encoding for proper Javadoc processing.</p>
- *
+ *
*/
public class ColognePhoneticTest extends StringEncoderAbstractTest {
@@ -44,10 +44,10 @@ public class ColognePhoneticTest extends
public void testAaclan() throws EncoderException {
this.checkEncoding("0856", "Aaclan");
}
-
+
/**
* Tests [CODEC-122]
- *
+ *
* @throws EncoderException
*/
@Test
@@ -106,7 +106,7 @@ public class ColognePhoneticTest extends
{"Wikipedia", "3412"},
{"peter", "127"},
{"pharma", "376"},
- {"m\u00f6nchengladbach", "664645214"}, // mönchengladbach
+ {"m\u00f6nchengladbach", "664645214"}, // mönchengladbach
{"deutsch", "28"},
{"deutz", "28"},
{"hamburg", "06174"},
@@ -126,7 +126,7 @@ public class ColognePhoneticTest extends
@Test
public void testHyphen() throws EncoderException {
- String[][] data = {{"bergisch-gladbach", "174845214"},
+ String[][] data = {{"bergisch-gladbach", "174845214"},
{"M\u00fcller-L\u00fcdenscheidt", "65752682"}}; // Müller-Lüdenscheidt
this.checkEncodings(data);
}
Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/DoubleMetaphone2Test.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/DoubleMetaphone2Test.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/DoubleMetaphone2Test.java (original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/DoubleMetaphone2Test.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* 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.
@@ -28,7 +28,7 @@ import org.junit.Test;
* <p>
* The test data was extracted from Stephen Woodbridge's <a
* href="http://swoodbridge.com/DoubleMetaPhone/surnames.txt">PHP test program</a>.
- *
+ *
* @see <a href="http://swoodbridge.com/DoubleMetaPhone/surnames.txt">PHP test program</a>
* @version $Id$
*/
Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/DoubleMetaphoneTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/DoubleMetaphoneTest.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/DoubleMetaphoneTest.java (original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/DoubleMetaphoneTest.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* 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.
@@ -29,9 +29,9 @@ import org.junit.Test;
/**
* Tests {@link DoubleMetaphone}.
- *
+ *
* <p>Keep this file in UTF-8 encoding for proper Javadoc processing.</p>
- *
+ *
* @see "http://www.cuj.com/documents/s=8038/cuj0006philips/"
* @version $Id$
*/
@@ -39,11 +39,11 @@ public class DoubleMetaphoneTest extends
/**
* Test data from http://aspell.sourceforge.net/test/batch0.tab.
- *
+ *
* "Copyright (C) 2002 Kevin Atkinson (kevina@gnu.org). Verbatim copying
* and distribution of this entire article is permitted in any medium,
* provided this notice is preserved."
- *
+ *
* Massaged the test data in the array below.
*/
private static final String[][] FIXTURE = { { "Accosinly", "Occasionally" }, {
@@ -1115,7 +1115,7 @@ public class DoubleMetaphoneTest extends
@Test
public void testSetMaxCodeLength() {
String value = "jumped";
-
+
DoubleMetaphone doubleMetaphone = new DoubleMetaphone();
// Sanity check of default settings
@@ -1225,12 +1225,12 @@ public class DoubleMetaphoneTest extends
public void testCCedilla() {
assertTrue(this.getDoubleMetaphone().isDoubleMetaphoneEqual("\u00e7", "S")); // c-cedilla
}
-
+
@Test
public void testNTilde() {
assertTrue(this.getDoubleMetaphone().isDoubleMetaphoneEqual("\u00f1", "N")); // n-tilde
}
-
+
public void validateFixture(String[][] pairs) {
if (pairs.length == 0) {
fail("Test fixture is empty");
Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/MetaphoneTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/MetaphoneTest.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/MetaphoneTest.java (original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/MetaphoneTest.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* 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.
@@ -54,7 +54,7 @@ public class MetaphoneTest extends Strin
assertTrue(failMsg, this.getMetaphone().isMetaphoneEqual(name1, name0));
}
}
-
+
/**
* @return Returns the metaphone.
*/
@@ -87,7 +87,7 @@ public class MetaphoneTest extends Strin
/**
* Initial AE case.
- *
+ *
* Match data computed from http://www.lanw.com/java/phonetic/default.htm
*/
@Test
@@ -97,7 +97,7 @@ public class MetaphoneTest extends Strin
/**
* Initial WH case.
- *
+ *
* Match data computed from http://www.lanw.com/java/phonetic/default.htm
*/
@Test
@@ -109,7 +109,7 @@ public class MetaphoneTest extends Strin
/**
* Initial A, not followed by an E case.
- *
+ *
* Match data computed from http://www.lanw.com/java/phonetic/default.htm
*/
@Test
@@ -242,7 +242,7 @@ public class MetaphoneTest extends Strin
/**
* Initial KN case.
- *
+ *
* Match data computed from http://www.lanw.com/java/phonetic/default.htm
*/
@Test
@@ -348,7 +348,7 @@ public class MetaphoneTest extends Strin
/**
* Initial WR case.
- *
+ *
* Match data computed from http://www.lanw.com/java/phonetic/default.htm
*/
@Test
@@ -380,7 +380,7 @@ public class MetaphoneTest extends Strin
assertEquals("LS", this.getMetaphone().metaphone("lazy"));
assertEquals("TKS", this.getMetaphone().metaphone("dogs"));
}
-
+
@Test
public void testWordEndingInMB() {
assertEquals( "KM", this.getMetaphone().metaphone("COMB") );
@@ -400,7 +400,7 @@ public class MetaphoneTest extends Strin
*/
@Test
public void testWhy() {
- // PHP returns "H". The original metaphone returns an empty string.
+ // PHP returns "H". The original metaphone returns an empty string.
assertEquals("", this.getMetaphone().metaphone("WHY"));
}
Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/NysiisTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/NysiisTest.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/NysiisTest.java (original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/NysiisTest.java Wed Jun 20 19:04:08 2012
@@ -25,18 +25,18 @@ import org.junit.Test;
/**
* Tests {@link Nysiis}
- *
+ *
* @since 1.7
* @version $Id$
*/
public class NysiisTest extends StringEncoderAbstractTest {
private final Nysiis fullNysiis = new Nysiis(false);
-
+
/**
* Takes an array of String pairs where each pair's first element is the input and the second element the expected
* encoding.
- *
+ *
* @param testValues
* an array of String pairs where each pair's first element is the input and the second element the
* expected encoding.
@@ -83,7 +83,7 @@ public class NysiisTest extends StringEn
/**
* Tests data gathered from around the internet.
- *
+ *
* @see <a href="http://www.dropby.com/NYSIISTextStrings.html">http://www.dropby.com/NYSIISTextStrings.html</a>
* @throws EncoderException
*/
@@ -152,7 +152,7 @@ public class NysiisTest extends StringEn
/**
* Tests data gathered from around the internets.
- *
+ *
* @throws EncoderException
*/
@Test
@@ -169,7 +169,7 @@ public class NysiisTest extends StringEn
/**
* Tests rule 1: Translate first characters of name: MAC â MCC, KN â N, K â C, PH, PF â FF, SCH â SSS
- *
+ *
* @throws EncoderException
*/
@Test
@@ -185,7 +185,7 @@ public class NysiisTest extends StringEn
/**
* Tests rule 2: Translate last characters of name: EE â Y, IE â Y, DT, RT, RD, NT, ND â D
- *
+ *
* @throws EncoderException
*/
@Test
@@ -202,7 +202,7 @@ public class NysiisTest extends StringEn
/**
* Tests rule 4.1: EV â AF else A, E, I, O, U â A
- *
+ *
* @throws EncoderException
*/
@Test
@@ -218,7 +218,7 @@ public class NysiisTest extends StringEn
/**
* Tests rule 4.2: Q â G, Z â S, M â N
- *
+ *
* @throws EncoderException
*/
@Test
@@ -231,7 +231,7 @@ public class NysiisTest extends StringEn
/**
* Tests rule 5: If last character is S, remove it.
- *
+ *
* @throws EncoderException
*/
@Test
@@ -243,7 +243,7 @@ public class NysiisTest extends StringEn
/**
* Tests rule 6: If last characters are AY, replace with Y.
- *
+ *
* @throws EncoderException
*/
@Test
@@ -255,7 +255,7 @@ public class NysiisTest extends StringEn
/**
* Tests rule 7: If last character is A, remove it.
- *
+ *
* @throws EncoderException
*/
@Test
Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/RefinedSoundexTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/RefinedSoundexTest.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/RefinedSoundexTest.java (original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/RefinedSoundexTest.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* 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.
@@ -26,7 +26,7 @@ import org.junit.Test;
/**
* Tests RefinedSoundex.
- *
+ *
* @version $Id$
*/
public class RefinedSoundexTest extends StringEncoderAbstractTest {
@@ -88,17 +88,17 @@ public class RefinedSoundexTest extends
char code = this.getRefinedSoundex().getMappingCode('#');
assertEquals("Code does not equals zero", 0, code);
}
-
+
@Test
public void testNewInstance() {
assertEquals("D6043", new RefinedSoundex().soundex("dogs"));
}
-
+
@Test
public void testNewInstance2() {
assertEquals("D6043", new RefinedSoundex(RefinedSoundex.US_ENGLISH_MAPPING_STRING.toCharArray()).soundex("dogs"));
}
-
+
@Test
public void testNewInstance3() {
assertEquals("D6043", new RefinedSoundex(RefinedSoundex.US_ENGLISH_MAPPING_STRING).soundex("dogs"));
Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/SoundexTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/SoundexTest.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/SoundexTest.java (original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/SoundexTest.java Wed Jun 20 19:04:08 2012
@@ -28,9 +28,9 @@ import org.junit.Test;
/**
* Tests {@link Soundex}.
- *
+ *
* <p>Keep this file in UTF-8 encoding for proper Javadoc processing.</p>
- *
+ *
* @version $Id$
*/
public class SoundexTest extends StringEncoderAbstractTest {
@@ -202,7 +202,7 @@ public class SoundexTest extends StringE
/**
* Test data from http://www.myatt.demon.co.uk/sxalg.htm
- *
+ *
* @throws EncoderException
*/
@Test
@@ -240,7 +240,7 @@ public class SoundexTest extends StringE
/**
* Consonants from the same code group separated by W or H are treated as one.
- *
+ *
* Test data from http://www.myatt.demon.co.uk/sxalg.htm
*/
@Test
@@ -251,7 +251,7 @@ public class SoundexTest extends StringE
/**
* Consonants from the same code group separated by W or H are treated as one.
- *
+ *
* @throws EncoderException
*/
@Test
@@ -292,7 +292,7 @@ public class SoundexTest extends StringE
* Examples for MS SQLServer from
* http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support
* /kb/articles/Q100/3/65.asp&NoWebContent=1
- *
+ *
* @throws EncoderException
*/
@Test
@@ -357,7 +357,7 @@ public class SoundexTest extends StringE
/**
* Fancy characters are not mapped by the default US mapping.
- *
+ *
* http://issues.apache.org/bugzilla/show_bug.cgi?id=29080
*/
@Test
@@ -378,7 +378,7 @@ public class SoundexTest extends StringE
/**
* Fancy characters are not mapped by the default US mapping.
- *
+ *
* http://issues.apache.org/bugzilla/show_bug.cgi?id=29080
*/
@Test
Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/bm/BeiderMorseEncoderTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/bm/BeiderMorseEncoderTest.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/bm/BeiderMorseEncoderTest.java (original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/bm/BeiderMorseEncoderTest.java Wed Jun 20 19:04:08 2012
@@ -29,7 +29,7 @@ import org.junit.Test;
/**
* Tests BeiderMorseEncoder.
- *
+ *
* @since 1.6
*/
public class BeiderMorseEncoderTest extends StringEncoderAbstractTest {
@@ -53,7 +53,7 @@ public class BeiderMorseEncoderTest exte
/**
* Tests we do not blow up.
- *
+ *
* @throws EncoderException
*/
@Test
@@ -101,7 +101,7 @@ public class BeiderMorseEncoderTest exte
/**
* Tests https://issues.apache.org/jira/browse/CODEC-125?focusedCommentId=13071566&page=com.atlassian.jira.plugin.system.issuetabpanels:
* comment-tabpanel#comment-13071566
- *
+ *
* @throws EncoderException
*/
@Test
@@ -184,7 +184,7 @@ public class BeiderMorseEncoderTest exte
/**
* (Un)luckily, the worse performing test because of the data in {@link #TEST_CHARS}
- *
+ *
* @throws EncoderException
*/
@Test(/* timeout = 20000L */)
Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/bm/LanguageGuessingTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/bm/LanguageGuessingTest.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/bm/LanguageGuessingTest.java (original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/bm/LanguageGuessingTest.java Wed Jun 20 19:04:08 2012
@@ -28,7 +28,7 @@ import org.junit.runners.Parameterized;
/**
* Tests guessLanguages API.
- *
+ *
* @since 1.6
*/
@RunWith(Parameterized.class)
Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/bm/PhoneticEngineTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/bm/PhoneticEngineTest.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/bm/PhoneticEngineTest.java (original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/bm/PhoneticEngineTest.java Wed Jun 20 19:04:08 2012
@@ -29,7 +29,7 @@ import org.junit.runners.Parameterized;
/**
* Tests PhoneticEngine.
- *
+ *
* @since 1.6
*/
@RunWith(Parameterized.class)
Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/bm/RuleTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/bm/RuleTest.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/bm/RuleTest.java (original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/bm/RuleTest.java Wed Jun 20 19:04:08 2012
@@ -26,7 +26,7 @@ import org.junit.Test;
/**
* Tests Rule.
- *
+ *
* @since 1.6
*/
public class RuleTest {
Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/BCodecTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/BCodecTest.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/BCodecTest.java (original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/BCodecTest.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* 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.
@@ -30,7 +30,7 @@ import org.junit.Test;
/**
* Quoted-printable codec test cases
- *
+ *
* @version $Id$
*/
public class BCodecTest {
Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/QCodecTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/QCodecTest.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/QCodecTest.java (original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/QCodecTest.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* 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.
@@ -33,25 +33,25 @@ import org.junit.Test;
/**
* Quoted-printable codec test cases
- *
+ *
* @version $Id$
*/
public class QCodecTest {
-
+
static final int SWISS_GERMAN_STUFF_UNICODE [] = {
0x47, 0x72, 0xFC, 0x65, 0x7A, 0x69, 0x5F, 0x7A, 0xE4, 0x6D, 0xE4
};
-
+
static final int RUSSIAN_STUFF_UNICODE [] = {
- 0x412, 0x441, 0x435, 0x43C, 0x5F, 0x43F, 0x440, 0x438,
- 0x432, 0x435, 0x442
- };
+ 0x412, 0x441, 0x435, 0x43C, 0x5F, 0x43F, 0x440, 0x438,
+ 0x432, 0x435, 0x442
+ };
private String constructString(int [] unicodeChars) {
StringBuilder buffer = new StringBuilder();
if (unicodeChars != null) {
for (int unicodeChar : unicodeChars) {
- buffer.append((char)unicodeChar);
+ buffer.append((char)unicodeChar);
}
}
return buffer.toString();
@@ -67,17 +67,17 @@ public class QCodecTest {
@Test
public void testUTF8RoundTrip() throws Exception {
- String ru_msg = constructString(RUSSIAN_STUFF_UNICODE);
- String ch_msg = constructString(SWISS_GERMAN_STUFF_UNICODE);
-
+ String ru_msg = constructString(RUSSIAN_STUFF_UNICODE);
+ String ch_msg = constructString(SWISS_GERMAN_STUFF_UNICODE);
+
QCodec qcodec = new QCodec(CharEncoding.UTF_8);
-
+
assertEquals(
- "=?UTF-8?Q?=D0=92=D1=81=D0=B5=D0=BC=5F=D0=BF=D1=80=D0=B8=D0=B2=D0=B5=D1=82?=",
+ "=?UTF-8?Q?=D0=92=D1=81=D0=B5=D0=BC=5F=D0=BF=D1=80=D0=B8=D0=B2=D0=B5=D1=82?=",
qcodec.encode(ru_msg)
);
assertEquals("=?UTF-8?Q?Gr=C3=BCezi=5Fz=C3=A4m=C3=A4?=", qcodec.encode(ch_msg));
-
+
assertEquals(ru_msg, qcodec.decode(qcodec.encode(ru_msg)));
assertEquals(ch_msg, qcodec.decode(qcodec.encode(ch_msg)));
}
@@ -88,9 +88,9 @@ public class QCodecTest {
QCodec qcodec = new QCodec();
String plain = "= Hello there =\r\n";
String encoded = qcodec.encode(plain);
- assertEquals("Basic Q encoding test",
+ assertEquals("Basic Q encoding test",
"=?UTF-8?Q?=3D Hello there =3D=0D=0A?=", encoded);
- assertEquals("Basic Q decoding test",
+ assertEquals("Basic Q decoding test",
plain, qcodec.decode(encoded));
}
@@ -99,18 +99,18 @@ public class QCodecTest {
QCodec qcodec = new QCodec();
String plain = "?_=\r\n";
String encoded = qcodec.encode(plain);
- assertEquals("Unsafe chars Q encoding test",
+ assertEquals("Unsafe chars Q encoding test",
"=?UTF-8?Q?=3F=5F=3D=0D=0A?=", encoded);
- assertEquals("Unsafe chars Q decoding test",
+ assertEquals("Unsafe chars Q decoding test",
plain, qcodec.decode(encoded));
}
@Test
public void testEncodeDecodeNull() throws Exception {
QCodec qcodec = new QCodec();
- assertNull("Null string Q encoding test",
+ assertNull("Null string Q encoding test",
qcodec.encode((String)null));
- assertNull("Null string Q decoding test",
+ assertNull("Null string Q decoding test",
qcodec.decode((String)null));
}
@@ -129,19 +129,19 @@ public class QCodecTest {
String result = qcodec.decode( test );
assertEquals("Result should be null", null, result);
}
-
+
@Test
public void testEncodeObjects() throws Exception {
QCodec qcodec = new QCodec();
String plain = "1+1 = 2";
String encoded = (String) qcodec.encode((Object) plain);
- assertEquals("Basic Q encoding test",
+ assertEquals("Basic Q encoding test",
"=?UTF-8?Q?1+1 =3D 2?=", encoded);
Object result = qcodec.encode((Object) null);
assertEquals( "Encoding a null Object should return null", null, result);
-
+
try {
Object dObj = new Double(3.0);
qcodec.encode( dObj );
@@ -150,7 +150,7 @@ public class QCodecTest {
// Exception expected, test segment passes.
}
}
-
+
@Test(expected=UnsupportedCharsetException.class)
public void testInvalidEncoding() {
@@ -162,12 +162,12 @@ public class QCodecTest {
QCodec qcodec = new QCodec();
String decoded = "=?UTF-8?Q?1+1 =3D 2?=";
String plain = (String) qcodec.decode((Object) decoded);
- assertEquals("Basic Q decoding test",
+ assertEquals("Basic Q decoding test",
"1+1 = 2", plain);
Object result = qcodec.decode((Object) null);
assertEquals( "Decoding a null Object should return null", null, result);
-
+
try {
Object dObj = new Double(3.0);
qcodec.decode( dObj );
Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/QuotedPrintableCodecTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/QuotedPrintableCodecTest.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/QuotedPrintableCodecTest.java (original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/QuotedPrintableCodecTest.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* 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.
@@ -32,25 +32,25 @@ import org.junit.Test;
/**
* Quoted-printable codec test cases
- *
+ *
* @version $Id$
*/
public class QuotedPrintableCodecTest {
-
+
static final int SWISS_GERMAN_STUFF_UNICODE [] = {
0x47, 0x72, 0xFC, 0x65, 0x7A, 0x69, 0x5F, 0x7A, 0xE4, 0x6D, 0xE4
};
-
+
static final int RUSSIAN_STUFF_UNICODE [] = {
- 0x412, 0x441, 0x435, 0x43C, 0x5F, 0x43F, 0x440, 0x438,
- 0x432, 0x435, 0x442
- };
+ 0x412, 0x441, 0x435, 0x43C, 0x5F, 0x43F, 0x440, 0x438,
+ 0x432, 0x435, 0x442
+ };
private String constructString(int [] unicodeChars) {
StringBuilder buffer = new StringBuilder();
if (unicodeChars != null) {
for (int unicodeChar : unicodeChars) {
- buffer.append((char)unicodeChar);
+ buffer.append((char)unicodeChar);
}
}
return buffer.toString();
@@ -59,17 +59,17 @@ public class QuotedPrintableCodecTest {
@Test
public void testUTF8RoundTrip() throws Exception {
- String ru_msg = constructString(RUSSIAN_STUFF_UNICODE);
- String ch_msg = constructString(SWISS_GERMAN_STUFF_UNICODE);
-
+ String ru_msg = constructString(RUSSIAN_STUFF_UNICODE);
+ String ch_msg = constructString(SWISS_GERMAN_STUFF_UNICODE);
+
QuotedPrintableCodec qpcodec = new QuotedPrintableCodec();
-
+
assertEquals(
- "=D0=92=D1=81=D0=B5=D0=BC_=D0=BF=D1=80=D0=B8=D0=B2=D0=B5=D1=82",
+ "=D0=92=D1=81=D0=B5=D0=BC_=D0=BF=D1=80=D0=B8=D0=B2=D0=B5=D1=82",
qpcodec.encode(ru_msg, CharEncoding.UTF_8)
);
assertEquals("Gr=C3=BCezi_z=C3=A4m=C3=A4", qpcodec.encode(ch_msg, CharEncoding.UTF_8));
-
+
assertEquals(ru_msg, qpcodec.decode(qpcodec.encode(ru_msg, CharEncoding.UTF_8), CharEncoding.UTF_8));
assertEquals(ch_msg, qpcodec.decode(qpcodec.encode(ch_msg, CharEncoding.UTF_8), CharEncoding.UTF_8));
}
@@ -79,9 +79,9 @@ public class QuotedPrintableCodecTest {
QuotedPrintableCodec qpcodec = new QuotedPrintableCodec();
String plain = "= Hello there =\r\n";
String encoded = qpcodec.encode(plain);
- assertEquals("Basic quoted-printable encoding test",
+ assertEquals("Basic quoted-printable encoding test",
"=3D Hello there =3D=0D=0A", encoded);
- assertEquals("Basic quoted-printable decoding test",
+ assertEquals("Basic quoted-printable decoding test",
plain, qpcodec.decode(encoded));
}
@@ -90,9 +90,9 @@ public class QuotedPrintableCodecTest {
QuotedPrintableCodec qpcodec = new QuotedPrintableCodec();
String plain = "abc123_-.*~!@#$%^&()+{}\"\\;:`,/[]";
String encoded = qpcodec.encode(plain);
- assertEquals("Safe chars quoted-printable encoding test",
+ assertEquals("Safe chars quoted-printable encoding test",
plain, encoded);
- assertEquals("Safe chars quoted-printable decoding test",
+ assertEquals("Safe chars quoted-printable decoding test",
plain, qpcodec.decode(encoded));
}
@@ -102,18 +102,18 @@ public class QuotedPrintableCodecTest {
QuotedPrintableCodec qpcodec = new QuotedPrintableCodec();
String plain = "=\r\n";
String encoded = qpcodec.encode(plain);
- assertEquals("Unsafe chars quoted-printable encoding test",
+ assertEquals("Unsafe chars quoted-printable encoding test",
"=3D=0D=0A", encoded);
- assertEquals("Unsafe chars quoted-printable decoding test",
+ assertEquals("Unsafe chars quoted-printable decoding test",
plain, qpcodec.decode(encoded));
}
@Test
public void testEncodeDecodeNull() throws Exception {
QuotedPrintableCodec qpcodec = new QuotedPrintableCodec();
- assertNull("Null string quoted-printable encoding test",
+ assertNull("Null string quoted-printable encoding test",
qpcodec.encode((String)null));
- assertNull("Null string quoted-printable decoding test",
+ assertNull("Null string quoted-printable decoding test",
qpcodec.decode((String)null));
}
@@ -146,21 +146,21 @@ public class QuotedPrintableCodecTest {
QuotedPrintableCodec qpcodec = new QuotedPrintableCodec();
byte[] plain = null;
byte[] encoded = qpcodec.encode(plain);
- assertEquals("Encoding a null string should return null",
+ assertEquals("Encoding a null string should return null",
null, encoded);
}
-
+
@Test
public void testEncodeUrlWithNullBitSet() throws Exception {
QuotedPrintableCodec qpcodec = new QuotedPrintableCodec();
String plain = "1+1 = 2";
String encoded = new String(QuotedPrintableCodec.
encodeQuotedPrintable(null, plain.getBytes(Charsets.UTF_8)));
- assertEquals("Basic quoted-printable encoding test",
+ assertEquals("Basic quoted-printable encoding test",
"1+1 =3D 2", encoded);
- assertEquals("Basic quoted-printable decoding test",
+ assertEquals("Basic quoted-printable decoding test",
plain, qpcodec.decode(encoded));
-
+
}
@Test
@@ -185,24 +185,24 @@ public class QuotedPrintableCodecTest {
String result = qpcodec.decode( test, "charset" );
assertEquals("Result should be null", null, result);
}
-
+
@Test
public void testEncodeObjects() throws Exception {
QuotedPrintableCodec qpcodec = new QuotedPrintableCodec();
String plain = "1+1 = 2";
String encoded = (String) qpcodec.encode((Object) plain);
- assertEquals("Basic quoted-printable encoding test",
+ assertEquals("Basic quoted-printable encoding test",
"1+1 =3D 2", encoded);
byte[] plainBA = plain.getBytes(Charsets.UTF_8);
byte[] encodedBA = (byte[]) qpcodec.encode((Object) plainBA);
encoded = new String(encodedBA);
- assertEquals("Basic quoted-printable encoding test",
+ assertEquals("Basic quoted-printable encoding test",
"1+1 =3D 2", encoded);
-
+
Object result = qpcodec.encode((Object) null);
assertEquals( "Encoding a null Object should return null", null, result);
-
+
try {
Object dObj = new Double(3.0);
qpcodec.encode( dObj );
@@ -211,7 +211,7 @@ public class QuotedPrintableCodecTest {
// Exception expected, test segment passes.
}
}
-
+
@Test(expected=UnsupportedCharsetException.class)
public void testInvalidEncoding() {
new QuotedPrintableCodec("NONSENSE");
@@ -222,18 +222,18 @@ public class QuotedPrintableCodecTest {
QuotedPrintableCodec qpcodec = new QuotedPrintableCodec();
String plain = "1+1 =3D 2";
String decoded = (String) qpcodec.decode((Object) plain);
- assertEquals("Basic quoted-printable decoding test",
+ assertEquals("Basic quoted-printable decoding test",
"1+1 = 2", decoded);
byte[] plainBA = plain.getBytes(Charsets.UTF_8);
byte[] decodedBA = (byte[]) qpcodec.decode((Object) plainBA);
decoded = new String(decodedBA);
- assertEquals("Basic quoted-printable decoding test",
+ assertEquals("Basic quoted-printable decoding test",
"1+1 = 2", decoded);
-
+
Object result = qpcodec.decode((Object) null);
assertEquals( "Decoding a null Object should return null", null, result);
-
+
try {
Object dObj = new Double(3.0);
qpcodec.decode( dObj );
@@ -257,7 +257,7 @@ public class QuotedPrintableCodecTest {
@Ignore
/**
* The QuotedPrintableCodec documentation states that this is not supported.
- *
+ *
* @throws Exception
* @see <a href="https://issues.apache.org/jira/browse/CODEC-121">CODEC-121</a>
*/
@@ -271,7 +271,7 @@ public class QuotedPrintableCodecTest {
@Ignore
/**
* The QuotedPrintableCodec documentation states that this is not supported.
- *
+ *
* @throws Exception
* @see <a href="https://issues.apache.org/jira/browse/CODEC-121">CODEC-121</a>
*/
Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/RFC1522CodecTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/RFC1522CodecTest.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/RFC1522CodecTest.java (original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/RFC1522CodecTest.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* 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.
@@ -26,7 +26,7 @@ import org.junit.Test;
/**
* RFC 1522 compliant codec test cases
- *
+ *
* @version $Id$
*/
public class RFC1522CodecTest {
Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/URLCodecTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/URLCodecTest.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/URLCodecTest.java (original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/URLCodecTest.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* 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.
@@ -31,49 +31,49 @@ import org.junit.Test;
/**
* URL codec test cases
- *
+ *
* @version $Id$
*/
public class URLCodecTest {
-
+
static final int SWISS_GERMAN_STUFF_UNICODE [] = {
0x47, 0x72, 0xFC, 0x65, 0x7A, 0x69, 0x5F, 0x7A, 0xE4, 0x6D, 0xE4
};
-
+
static final int RUSSIAN_STUFF_UNICODE [] = {
- 0x412, 0x441, 0x435, 0x43C, 0x5F, 0x43F, 0x440, 0x438,
- 0x432, 0x435, 0x442
- };
+ 0x412, 0x441, 0x435, 0x43C, 0x5F, 0x43F, 0x440, 0x438,
+ 0x432, 0x435, 0x442
+ };
private void validateState(URLCodec urlCodec) {
// no tests for now.
}
-
+
private String constructString(int [] unicodeChars) {
StringBuilder buffer = new StringBuilder();
if (unicodeChars != null) {
for (int unicodeChar : unicodeChars) {
- buffer.append((char)unicodeChar);
+ buffer.append((char)unicodeChar);
}
}
return buffer.toString();
}
-
+
@Test
public void testUTF8RoundTrip() throws Exception {
- String ru_msg = constructString(RUSSIAN_STUFF_UNICODE);
- String ch_msg = constructString(SWISS_GERMAN_STUFF_UNICODE);
-
+ String ru_msg = constructString(RUSSIAN_STUFF_UNICODE);
+ String ch_msg = constructString(SWISS_GERMAN_STUFF_UNICODE);
+
URLCodec urlCodec = new URLCodec();
this.validateState(urlCodec);
-
+
assertEquals(
- "%D0%92%D1%81%D0%B5%D0%BC_%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82",
+ "%D0%92%D1%81%D0%B5%D0%BC_%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82",
urlCodec.encode(ru_msg, CharEncoding.UTF_8)
);
assertEquals("Gr%C3%BCezi_z%C3%A4m%C3%A4", urlCodec.encode(ch_msg, CharEncoding.UTF_8));
-
+
assertEquals(ru_msg, urlCodec.decode(urlCodec.encode(ru_msg, CharEncoding.UTF_8), CharEncoding.UTF_8));
assertEquals(ch_msg, urlCodec.decode(urlCodec.encode(ch_msg, CharEncoding.UTF_8), CharEncoding.UTF_8));
this.validateState(urlCodec);
@@ -84,9 +84,9 @@ public class URLCodecTest {
URLCodec urlCodec = new URLCodec();
String plain = "Hello there!";
String encoded = urlCodec.encode(plain);
- assertEquals("Basic URL encoding test",
+ assertEquals("Basic URL encoding test",
"Hello+there%21", encoded);
- assertEquals("Basic URL decoding test",
+ assertEquals("Basic URL decoding test",
plain, urlCodec.decode(encoded));
this.validateState(urlCodec);
}
@@ -97,9 +97,9 @@ public class URLCodecTest {
URLCodec urlCodec = new URLCodec();
String plain = "abc123_-.*";
String encoded = urlCodec.encode(plain);
- assertEquals("Safe chars URL encoding test",
+ assertEquals("Safe chars URL encoding test",
plain, encoded);
- assertEquals("Safe chars URL decoding test",
+ assertEquals("Safe chars URL decoding test",
plain, urlCodec.decode(encoded));
this.validateState(urlCodec);
}
@@ -110,9 +110,9 @@ public class URLCodecTest {
URLCodec urlCodec = new URLCodec();
String plain = "~!@#$%^&()+{}\"\\;:`,/[]";
String encoded = urlCodec.encode(plain);
- assertEquals("Unsafe chars URL encoding test",
+ assertEquals("Unsafe chars URL encoding test",
"%7E%21%40%23%24%25%5E%26%28%29%2B%7B%7D%22%5C%3B%3A%60%2C%2F%5B%5D", encoded);
- assertEquals("Unsafe chars URL decoding test",
+ assertEquals("Unsafe chars URL decoding test",
plain, urlCodec.decode(encoded));
this.validateState(urlCodec);
}
@@ -121,9 +121,9 @@ public class URLCodecTest {
@Test
public void testEncodeDecodeNull() throws Exception {
URLCodec urlCodec = new URLCodec();
- assertNull("Null string URL encoding test",
+ assertNull("Null string URL encoding test",
urlCodec.encode((String)null));
- assertNull("Null string URL decoding test",
+ assertNull("Null string URL decoding test",
urlCodec.decode((String)null));
this.validateState(urlCodec);
}
@@ -143,7 +143,7 @@ public class URLCodecTest {
fail("DecoderException should have been thrown");
} catch (DecoderException e) {
// Expected. Move on
- }
+ }
try {
// Bad 1st char after %
urlCodec.decode("%WW");
@@ -163,7 +163,7 @@ public class URLCodecTest {
@Test
public void testDecodeInvalidContent() throws UnsupportedEncodingException, DecoderException {
- String ch_msg = constructString(SWISS_GERMAN_STUFF_UNICODE);
+ String ch_msg = constructString(SWISS_GERMAN_STUFF_UNICODE);
URLCodec urlCodec = new URLCodec();
byte[] input = ch_msg.getBytes("ISO-8859-1");
byte[] output = urlCodec.decode(input);
@@ -179,21 +179,21 @@ public class URLCodecTest {
URLCodec urlCodec = new URLCodec();
byte[] plain = null;
byte[] encoded = urlCodec.encode(plain);
- assertEquals("Encoding a null string should return null",
+ assertEquals("Encoding a null string should return null",
null, encoded);
this.validateState(urlCodec);
}
-
+
@Test
public void testEncodeUrlWithNullBitSet() throws Exception {
URLCodec urlCodec = new URLCodec();
String plain = "Hello there!";
String encoded = new String( URLCodec.encodeUrl(null, plain.getBytes(Charsets.UTF_8)));
- assertEquals("Basic URL encoding test",
+ assertEquals("Basic URL encoding test",
"Hello+there%21", encoded);
- assertEquals("Basic URL decoding test",
+ assertEquals("Basic URL decoding test",
plain, urlCodec.decode(encoded));
- this.validateState(urlCodec);
+ this.validateState(urlCodec);
}
@Test
@@ -218,24 +218,24 @@ public class URLCodecTest {
String result = urlCodec.decode( test, "charset" );
assertEquals("Result should be null", null, result);
}
-
+
@Test
public void testEncodeObjects() throws Exception {
URLCodec urlCodec = new URLCodec();
String plain = "Hello there!";
String encoded = (String) urlCodec.encode((Object) plain);
- assertEquals("Basic URL encoding test",
+ assertEquals("Basic URL encoding test",
"Hello+there%21", encoded);
byte[] plainBA = plain.getBytes(Charsets.UTF_8);
byte[] encodedBA = (byte[]) urlCodec.encode((Object) plainBA);
encoded = new String(encodedBA);
- assertEquals("Basic URL encoding test",
+ assertEquals("Basic URL encoding test",
"Hello+there%21", encoded);
-
+
Object result = urlCodec.encode((Object) null);
assertEquals( "Encoding a null Object should return null", null, result);
-
+
try {
Object dObj = new Double(3.0);
urlCodec.encode( dObj );
@@ -245,7 +245,7 @@ public class URLCodecTest {
}
this.validateState(urlCodec);
}
-
+
@Test
public void testInvalidEncoding() {
URLCodec urlCodec = new URLCodec("NONSENSE");
@@ -270,18 +270,18 @@ public class URLCodecTest {
URLCodec urlCodec = new URLCodec();
String plain = "Hello+there%21";
String decoded = (String) urlCodec.decode((Object) plain);
- assertEquals("Basic URL decoding test",
+ assertEquals("Basic URL decoding test",
"Hello there!", decoded);
byte[] plainBA = plain.getBytes(Charsets.UTF_8);
byte[] decodedBA = (byte[]) urlCodec.decode((Object) plainBA);
decoded = new String(decodedBA);
- assertEquals("Basic URL decoding test",
+ assertEquals("Basic URL decoding test",
"Hello there!", decoded);
-
+
Object result = urlCodec.decode((Object) null);
assertEquals( "Decoding a null Object should return null", null, result);
-
+
try {
Object dObj = new Double(3.0);
urlCodec.decode( dObj );
Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/UtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/UtilsTest.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/UtilsTest.java (original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/net/UtilsTest.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* 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.
@@ -24,7 +24,7 @@ import org.junit.Test;
* <p>
* Methods currently get 100%/100% line/branch code coverage from other tests classes.
* </p>
- *
+ *
* @version $Id$
* @since 1.4
*/