Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 19974 invoked from network); 30 Jul 2003 22:34:07 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 30 Jul 2003 22:34:07 -0000 Received: (qmail 10286 invoked by uid 97); 30 Jul 2003 22:36:49 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@nagoya.betaversion.org Received: (qmail 10279 invoked from network); 30 Jul 2003 22:36:48 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 30 Jul 2003 22:36:48 -0000 Received: (qmail 19756 invoked by uid 500); 30 Jul 2003 22:34:05 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 19745 invoked by uid 500); 30 Jul 2003 22:34:05 -0000 Received: (qmail 19738 invoked from network); 30 Jul 2003 22:34:04 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 30 Jul 2003 22:34:04 -0000 Received: (qmail 19411 invoked by uid 1628); 30 Jul 2003 22:34:18 -0000 Date: 30 Jul 2003 22:34:18 -0000 Message-ID: <20030730223418.19410.qmail@minotaur.apache.org> From: tobrien@apache.org To: jakarta-commons-cvs@apache.org Subject: cvs commit: jakarta-commons/codec/src/test/org/apache/commons/codec/binary Base64Test.java HexTest.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N tobrien 2003/07/30 15:34:18 Modified: codec/src/java/org/apache/commons/codec BinaryDecoder.java BinaryEncoder.java Decoder.java DecoderException.java Encoder.java EncoderException.java StringDecoder.java StringEncoder.java StringEncoderComparator.java codec/src/java/org/apache/commons/codec/binary Base64.java Hex.java codec/src/java/org/apache/commons/codec/language Metaphone.java RefinedSoundex.java Soundex.java codec/src/test/org/apache/commons/codec BinaryEncoderAbstractTest.java StringEncoderAbstractTest.java StringEncoderComparatorTest.java codec/src/test/org/apache/commons/codec/binary Base64Test.java HexTest.java Log: author tag change, removed my email address from author tags Revision Changes Path 1.3 +2 -2 jakarta-commons/codec/src/java/org/apache/commons/codec/BinaryDecoder.java Index: BinaryDecoder.java =================================================================== RCS file: /home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/BinaryDecoder.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- BinaryDecoder.java 25 Jul 2003 22:48:11 -0000 1.2 +++ BinaryDecoder.java 30 Jul 2003 22:34:17 -0000 1.3 @@ -59,7 +59,7 @@ * This interface defines common decoding methods for decoders * which decode byte arrays. * - * @author Tim O'Brien + * @author Tim O'Brien * @version $Id$ */ public interface BinaryDecoder extends Decoder { 1.3 +2 -2 jakarta-commons/codec/src/java/org/apache/commons/codec/BinaryEncoder.java Index: BinaryEncoder.java =================================================================== RCS file: /home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/BinaryEncoder.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- BinaryEncoder.java 25 Jul 2003 22:48:11 -0000 1.2 +++ BinaryEncoder.java 30 Jul 2003 22:34:17 -0000 1.3 @@ -57,7 +57,7 @@ * A binary encoder contains methods common to all * encoders for binary data. * - * @author Tim O'Brien + * @author Tim O'Brien * @version $Id$ */ public interface BinaryEncoder extends Encoder { 1.3 +2 -2 jakarta-commons/codec/src/java/org/apache/commons/codec/Decoder.java Index: Decoder.java =================================================================== RCS file: /home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/Decoder.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Decoder.java 25 Jul 2003 22:48:11 -0000 1.2 +++ Decoder.java 30 Jul 2003 22:34:17 -0000 1.3 @@ -59,7 +59,7 @@ * which allows a user to pass a generic Object to any * Decoder implementation in the codec package. * - * @author Tim O'Brien + * @author Tim O'Brien * @version $Id$ */ public interface Decoder { 1.3 +2 -2 jakarta-commons/codec/src/java/org/apache/commons/codec/DecoderException.java Index: DecoderException.java =================================================================== RCS file: /home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/DecoderException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- DecoderException.java 25 Jul 2003 22:48:11 -0000 1.2 +++ DecoderException.java 30 Jul 2003 22:34:17 -0000 1.3 @@ -57,7 +57,7 @@ * The DecoderException is thrown when a Decoder has * encounter a failure condition during a decode. * - * @author Tim O'Brien + * @author Tim O'Brien * @version $Id$ */ public class DecoderException extends Exception { 1.3 +2 -2 jakarta-commons/codec/src/java/org/apache/commons/codec/Encoder.java Index: Encoder.java =================================================================== RCS file: /home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/Encoder.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Encoder.java 25 Jul 2003 22:48:11 -0000 1.2 +++ Encoder.java 30 Jul 2003 22:34:17 -0000 1.3 @@ -58,7 +58,7 @@ * the highest level of abstraction for Encoders. All * Encoders implement this common generic interface. * - * @author Tim O'Brien + * @author Tim O'Brien * @version $Id$ */ public interface Encoder { 1.3 +2 -2 jakarta-commons/codec/src/java/org/apache/commons/codec/EncoderException.java Index: EncoderException.java =================================================================== RCS file: /home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/EncoderException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- EncoderException.java 25 Jul 2003 22:48:11 -0000 1.2 +++ EncoderException.java 30 Jul 2003 22:34:17 -0000 1.3 @@ -57,7 +57,7 @@ * An EncoderException is thrown when there is a * failure condition during the encoding process. * - * @author Tim O'Brien + * @author Tim O'Brien * @version $Id$ */ public class EncoderException extends Exception { 1.3 +2 -2 jakarta-commons/codec/src/java/org/apache/commons/codec/StringDecoder.java Index: StringDecoder.java =================================================================== RCS file: /home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/StringDecoder.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- StringDecoder.java 25 Jul 2003 22:48:11 -0000 1.2 +++ StringDecoder.java 30 Jul 2003 22:34:17 -0000 1.3 @@ -58,7 +58,7 @@ * a method parameter and one that produces a String as the * output of the decoding process. * - * @author tobrien@transolutions.net + * @author Tim O'Brien * @version $Id$ */ public interface StringDecoder extends Decoder { 1.3 +2 -2 jakarta-commons/codec/src/java/org/apache/commons/codec/StringEncoder.java Index: StringEncoder.java =================================================================== RCS file: /home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/StringEncoder.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- StringEncoder.java 25 Jul 2003 22:48:11 -0000 1.2 +++ StringEncoder.java 30 Jul 2003 22:34:17 -0000 1.3 @@ -58,7 +58,7 @@ * a method parameter and one that produces a String as the * output of the Encoding process. * - * @author tobrien@transolutions.net + * @author Tim O'Brien * @version $Id$ */ public interface StringEncoder extends Encoder { 1.3 +2 -2 jakarta-commons/codec/src/java/org/apache/commons/codec/StringEncoderComparator.java Index: StringEncoderComparator.java =================================================================== RCS file: /home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/StringEncoderComparator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- StringEncoderComparator.java 25 Jul 2003 22:48:11 -0000 1.2 +++ StringEncoderComparator.java 30 Jul 2003 22:34:17 -0000 1.3 @@ -64,7 +64,7 @@ * handy if one need to sort Strings by an encoded * form of a name such as Soundex. * - * @author Tim O'Brien + * @author Tim O'Brien * @version $Id$ */ public class StringEncoderComparator implements Comparator { 1.7 +7 -7 jakarta-commons/codec/src/java/org/apache/commons/codec/binary/Base64.java Index: Base64.java =================================================================== RCS file: /home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/binary/Base64.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- Base64.java 25 Jul 2003 22:48:11 -0000 1.6 +++ Base64.java 30 Jul 2003 22:34:17 -0000 1.7 @@ -75,10 +75,10 @@ * Internet Message Bodies. Reference 1996. * * @author Jeffrey Rodriguez - * @author Daniel Rall - * @author Martin Redington + * @author Daniel Rall + * @author Martin Redington * @author Gary Gregory - * @author Tim O'Brien + * @author Tim O'Brien * @since 1.0-dev * @version $Id$ */ 1.6 +2 -2 jakarta-commons/codec/src/java/org/apache/commons/codec/binary/Hex.java Index: Hex.java =================================================================== RCS file: /home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/binary/Hex.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Hex.java 25 Jul 2003 22:56:22 -0000 1.5 +++ Hex.java 30 Jul 2003 22:34:17 -0000 1.6 @@ -63,7 +63,7 @@ * Hex encoder/decoder. * * @author Christopher O'Brien - * @author Tim O'Brien + * @author Tim O'Brien * @version $Id$ */ public class Hex implements BinaryEncoder, BinaryDecoder { 1.4 +2 -2 jakarta-commons/codec/src/java/org/apache/commons/codec/language/Metaphone.java Index: Metaphone.java =================================================================== RCS file: /home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/language/Metaphone.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Metaphone.java 25 Jul 2003 22:48:11 -0000 1.3 +++ Metaphone.java 30 Jul 2003 22:34:18 -0000 1.4 @@ -66,7 +66,7 @@ * * @author wbrogden@bga.com * @author bayard@generationjava.com - * @author tobrien@transolutions.net + * @author Tim O'Brien * @version $Id$ */ public class Metaphone implements StringEncoder { 1.7 +2 -2 jakarta-commons/codec/src/java/org/apache/commons/codec/language/RefinedSoundex.java Index: RefinedSoundex.java =================================================================== RCS file: /home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/language/RefinedSoundex.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- RefinedSoundex.java 25 Jul 2003 22:48:11 -0000 1.6 +++ RefinedSoundex.java 30 Jul 2003 22:34:18 -0000 1.7 @@ -62,7 +62,7 @@ * "Soundex" method originally developed by Margaret Odell and * Robert Russell * - * @author tobrien@transolutions.net + * @author Tim O'Brien * @author ggregory@seagullsw.com * @version $Id$ */ 1.6 +2 -2 jakarta-commons/codec/src/java/org/apache/commons/codec/language/Soundex.java Index: Soundex.java =================================================================== RCS file: /home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/language/Soundex.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Soundex.java 25 Jul 2003 22:48:11 -0000 1.5 +++ Soundex.java 30 Jul 2003 22:34:18 -0000 1.6 @@ -62,7 +62,7 @@ * scheme to find word with similar phonemes. * * @author bayard@generationjava.com - * @author tobrien@transolutions.net + * @author Tim O'Brien * @author ggregory@seagullsw.com * @version $Id$ */ 1.2 +4 -4 jakarta-commons/codec/src/test/org/apache/commons/codec/BinaryEncoderAbstractTest.java Index: BinaryEncoderAbstractTest.java =================================================================== RCS file: /home/cvs/jakarta-commons/codec/src/test/org/apache/commons/codec/BinaryEncoderAbstractTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- BinaryEncoderAbstractTest.java 25 Apr 2003 17:50:56 -0000 1.1 +++ BinaryEncoderAbstractTest.java 30 Jul 2003 22:34:18 -0000 1.2 @@ -65,7 +65,7 @@ /** * @version $Revision$ $Date$ * @author Rodney Waldhoff - * @author Tim O'Brien + * @author Tim O'Brien */ public abstract class BinaryEncoderAbstractTest extends TestCase { 1.2 +5 -5 jakarta-commons/codec/src/test/org/apache/commons/codec/StringEncoderAbstractTest.java Index: StringEncoderAbstractTest.java =================================================================== RCS file: /home/cvs/jakarta-commons/codec/src/test/org/apache/commons/codec/StringEncoderAbstractTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- StringEncoderAbstractTest.java 25 Apr 2003 17:50:56 -0000 1.1 +++ StringEncoderAbstractTest.java 30 Jul 2003 22:34:18 -0000 1.2 @@ -65,7 +65,7 @@ /** * @version $Revision$ $Date$ * @author Rodney Waldhoff - * @author Tim O'Brien + * @author Tim O'Brien */ public abstract class StringEncoderAbstractTest extends TestCase { 1.2 +91 -91 jakarta-commons/codec/src/test/org/apache/commons/codec/StringEncoderComparatorTest.java Index: StringEncoderComparatorTest.java =================================================================== RCS file: /home/cvs/jakarta-commons/codec/src/test/org/apache/commons/codec/StringEncoderComparatorTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- StringEncoderComparatorTest.java 25 Apr 2003 17:50:56 -0000 1.1 +++ StringEncoderComparatorTest.java 30 Jul 2003 22:34:18 -0000 1.2 @@ -1,91 +1,91 @@ -/* - * $Header$ - * $Revision$ - * $Date$ - * - * ==================================================================== - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2003 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Commons", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - */ -package org.apache.commons.codec; - -import junit.framework.TestCase; - -import org.apache.commons.codec.language.Soundex; - -/** - * @version $Revision$ $Date$ - * @author Tim O'Brien - */ -public class StringEncoderComparatorTest extends TestCase { - - public StringEncoderComparatorTest(String name) { - super(name); - } - - public void testComparatorNoArgCon() throws Exception { - new StringEncoderComparator(); - } - - public void testComparatorWithSoundex() throws Exception { - StringEncoderComparator sCompare = - new StringEncoderComparator( new Soundex() ); - - assertTrue( "O'Brien and O'Brian didn't come out with " + - "the same Soundex, something must be wrong here", - 0 == sCompare.compare( "O'Brien", "O'Brian" ) ); - - } - -} +/* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2003 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Commons", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + * + */ +package org.apache.commons.codec; + +import junit.framework.TestCase; + +import org.apache.commons.codec.language.Soundex; + +/** + * @version $Revision$ $Date$ + * @author Tim O'Brien + */ +public class StringEncoderComparatorTest extends TestCase { + + public StringEncoderComparatorTest(String name) { + super(name); + } + + public void testComparatorNoArgCon() throws Exception { + new StringEncoderComparator(); + } + + public void testComparatorWithSoundex() throws Exception { + StringEncoderComparator sCompare = + new StringEncoderComparator( new Soundex() ); + + assertTrue( "O'Brien and O'Brian didn't come out with " + + "the same Soundex, something must be wrong here", + 0 == sCompare.compare( "O'Brien", "O'Brian" ) ); + + } + +} 1.5 +5 -5 jakarta-commons/codec/src/test/org/apache/commons/codec/binary/Base64Test.java Index: Base64Test.java =================================================================== RCS file: /home/cvs/jakarta-commons/codec/src/test/org/apache/commons/codec/binary/Base64Test.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Base64Test.java 25 Jul 2003 22:57:35 -0000 1.4 +++ Base64Test.java 30 Jul 2003 22:34:18 -0000 1.5 @@ -70,7 +70,7 @@ * @version $Revision$ $Date$ * @author Scott Sanders * @author Rodney Waldhoff - * @author Tim O'Brien + * @author Tim O'Brien * @author Gary Gregory */ public class Base64Test extends TestCase { 1.2 +133 -133 jakarta-commons/codec/src/test/org/apache/commons/codec/binary/HexTest.java Index: HexTest.java =================================================================== RCS file: /home/cvs/jakarta-commons/codec/src/test/org/apache/commons/codec/binary/HexTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- HexTest.java 25 Apr 2003 17:50:56 -0000 1.1 +++ HexTest.java 30 Jul 2003 22:34:18 -0000 1.2 @@ -1,133 +1,133 @@ -/* - * $Header$ - * $Revision$ - * $Date$ - * - * ==================================================================== - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2003 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Commons", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - */ -package org.apache.commons.codec.binary; - -import java.util.Arrays; -import java.util.Random; - -import junit.framework.TestCase; - -/** - * - * @author Christopher O'Brien - * @author Tim O'Brien - */ - -public class HexTest extends TestCase { - - public HexTest(String name) { - super(name); - } - - public void testEncodeEmpty() throws Exception { - char[] c = Hex.encodeHex(new byte[0]); - assertTrue(Arrays.equals(new char[0], c)); - } - - public void testEncodeZeroes() throws Exception { - char[] c = Hex.encodeHex(new byte[36]); - assertEquals( - "000000000000000000000000000000000000" - + "000000000000000000000000000000000000", - new String(c)); - } - - public void testHelloWorld() throws Exception { - byte[] b = "Hello World".getBytes(); - char[] c = Hex.encodeHex(b); - assertEquals("48656c6c6f20576f726c64", new String(c)); - } - - public void testEncodeDecodeRandom() throws Exception { - Random random = new Random(); - - for (int i = 5; i > 0; i--) { - byte[] data = new byte[random.nextInt(10000) + 1]; - random.nextBytes(data); - - char[] enc = Hex.encodeHex(data); - byte[] data2 = Hex.decodeHex(enc); - - assertTrue(Arrays.equals(data, data2)); - } - } - - public void testOddCharacters() throws Exception { - - boolean exceptionThrown = false; - - try { - char[] singleChar = new char[1]; - singleChar[0] = 'a'; - - Hex.decodeHex( singleChar ); - } - catch (Exception e) { - exceptionThrown = true; - } - - assertTrue( "An exception wasn't thrown when trying to " + - "decode an odd number of characters", exceptionThrown ); - - - } - -} +/* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2003 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Commons", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + * + */ +package org.apache.commons.codec.binary; + +import java.util.Arrays; +import java.util.Random; + +import junit.framework.TestCase; + +/** + * + * @author Christopher O'Brien + * @author Tim O'Brien + */ + +public class HexTest extends TestCase { + + public HexTest(String name) { + super(name); + } + + public void testEncodeEmpty() throws Exception { + char[] c = Hex.encodeHex(new byte[0]); + assertTrue(Arrays.equals(new char[0], c)); + } + + public void testEncodeZeroes() throws Exception { + char[] c = Hex.encodeHex(new byte[36]); + assertEquals( + "000000000000000000000000000000000000" + + "000000000000000000000000000000000000", + new String(c)); + } + + public void testHelloWorld() throws Exception { + byte[] b = "Hello World".getBytes(); + char[] c = Hex.encodeHex(b); + assertEquals("48656c6c6f20576f726c64", new String(c)); + } + + public void testEncodeDecodeRandom() throws Exception { + Random random = new Random(); + + for (int i = 5; i > 0; i--) { + byte[] data = new byte[random.nextInt(10000) + 1]; + random.nextBytes(data); + + char[] enc = Hex.encodeHex(data); + byte[] data2 = Hex.decodeHex(enc); + + assertTrue(Arrays.equals(data, data2)); + } + } + + public void testOddCharacters() throws Exception { + + boolean exceptionThrown = false; + + try { + char[] singleChar = new char[1]; + singleChar[0] = 'a'; + + Hex.decodeHex( singleChar ); + } + catch (Exception e) { + exceptionThrown = true; + } + + assertTrue( "An exception wasn't thrown when trying to " + + "decode an odd number of characters", exceptionThrown ); + + + } + +} --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org