Index: lutinutil/src/test/org/codelutin/util/ArrayUtilTest.java diff -u /dev/null lutinutil/src/test/org/codelutin/util/ArrayUtilTest.java:1.1 --- /dev/null Tue Nov 2 16:52:05 2004 +++ lutinutil/src/test/org/codelutin/util/ArrayUtilTest.java Tue Nov 2 16:52:00 2004 @@ -0,0 +1,57 @@ +/* *##% + * Copyright (C) 2002, 2003, 2004 Code Lutin, Cédric Pineau, + * Benjamin Poussin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * ArrayUtilTest.java + * + * Created: 31 oct. 2004 + * + * @author Benjamin Poussin + * @version $Revision: 1.1 $ + * + * Mise a jour: $Date: 2004/11/02 16:52:00 $ + * par : $Author: bpoussin $ + */ + +package org.codelutin.util; + +import java.util.LinkedList; +import java.util.List; +import junit.framework.TestCase; + +public class ArrayUtilTest extends TestCase { // ArrayUtilTest + + public void testAsList() throws Exception { + double [] dval = new double[4]; + dval[0] = 1; + dval[1] = 3.4; + dval[2] = 56; + dval[3] = 6.7; + + List lval = new LinkedList(); + lval.add(new Double(1)); + lval.add(new Double(3.4)); + lval.add(new Double(56)); + lval.add(new Double(6.7)); + + assertEquals(lval, ArrayUtil.asList(dval)); + } + +} // ArrayUtilTest + Index: lutinutil/src/test/org/codelutin/util/StringUtilTest.java diff -u /dev/null lutinutil/src/test/org/codelutin/util/StringUtilTest.java:1.1 --- /dev/null Tue Nov 2 16:52:05 2004 +++ lutinutil/src/test/org/codelutin/util/StringUtilTest.java Tue Nov 2 16:52:00 2004 @@ -0,0 +1,62 @@ +/* *##% + * Copyright (C) 2002, 2003 Code Lutin, Cédric Pineau, + Benjamin Poussin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * StringUtilTest.java + * + * Created: 7 oct. 2004 + * + * @author Benjamin Poussin + * @version $Revision: 1.1 $ + * + * Mise a jour: $Date: 2004/11/02 16:52:00 $ + * par : $Author: bpoussin $ + */ + +package org.codelutin.util; + +import java.awt.Color; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestResult; +import junit.framework.TestSuite; + +public class StringUtilTest extends TestCase { // StringUtilTest + + public void testToColor() throws Exception { + Color c; + + c = StringUtil.toColor("#FF55AA"); + assertEquals(c, new Color(255, 85, 170)); + + c = StringUtil.toColor("#FF55AA55"); + assertEquals(c, new Color(255, 85, 170, 85)); + + c = StringUtil.toColor("red"); + assertEquals(c, Color.red); + + c = StringUtil.toColor("toto"); + assertNull(c); + + c = StringUtil.toColor("#ZRETJ4040R"); + assertNull(c); + } + +} // StringUtilTest +