[Japi-cvs] SF.net SVN: japi: [8] trunk/src/test/net/sf/japi
Status: Beta
Brought to you by:
christianhujer
From: <chr...@us...> - 2006-04-04 22:22:01
|
Revision: 8 Author: christianhujer Date: 2006-04-04 15:21:47 -0700 (Tue, 04 Apr 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=8&view=rev Log Message: ----------- Added some unit tests. Improved test structure. Added Paths: ----------- trunk/src/test/net/sf/japi/lang/SuperClassIteratorTest.java trunk/src/test/net/sf/japi/util/ trunk/src/test/net/sf/japi/util/Arrays2Test.java Removed Paths: ------------- trunk/src/test/net/sf/japi/lang/test/ Copied: trunk/src/test/net/sf/japi/lang/SuperClassIteratorTest.java (from rev 7, trunk/src/test/net/sf/japi/lang/test/SuperClassIteratorTest.java) =================================================================== --- trunk/src/test/net/sf/japi/lang/SuperClassIteratorTest.java (rev 0) +++ trunk/src/test/net/sf/japi/lang/SuperClassIteratorTest.java 2006-04-04 22:21:47 UTC (rev 8) @@ -0,0 +1,57 @@ +/* JAPI - (Yet another (hopefully) useful) Java API + * + * Copyright (C) 2004-2006 Christian Hujer + * + * 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. + */ + +package test.net.sf.japi.lang; + +/** Test for SuperClassIterator. + * @author <a href="mailto:ch...@it...">Christian Hujer</a> + */ + +import junit.framework.TestCase; +import net.sf.japi.lang.SuperClassIterator; + +/** Test for {@link SuperClassIterator}. + * @author <a href="mailto:ch...@it...">Christian Hujer</a> + */ +public class SuperClassIteratorTest extends TestCase { + + /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + super.setUp(); + } + + /** {@inheritDoc} */ + @Override public void tearDown() throws Exception { + super.tearDown(); + } + + /** Test case for {@link SuperClassIterator#SuperClassIterator(Class<?>)}. */ + public void testSuperClassIterator() throws Exception { + final SuperClassIterator it = new SuperClassIterator(null); + assertFalse("SuperClassIterator with null class must not have next.", it.hasNext()); + try { + it.remove(); + fail("Expected UnsupportedOperationException."); + } catch (final UnsupportedOperationException ignore) { + /* ignore */ + } + } + +} // class SuperClassIteratorTest Property changes on: trunk/src/test/net/sf/japi/lang/SuperClassIteratorTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/src/test/net/sf/japi/util/Arrays2Test.java =================================================================== --- trunk/src/test/net/sf/japi/util/Arrays2Test.java (rev 0) +++ trunk/src/test/net/sf/japi/util/Arrays2Test.java 2006-04-04 22:21:47 UTC (rev 8) @@ -0,0 +1,61 @@ +/* JAPI - (Yet another (hopefully) useful) Java API + * + * Copyright (C) 2004-2006 Christian Hujer + * + * 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. + */ + +package test.net.sf.japi.util; + +/** TODO + * @author <a href="mailto:ch...@it...">Christian Hujer</a> + */ + +import java.util.Arrays; +import junit.framework.TestCase; +import net.sf.japi.util.Arrays2; + +/** + * Test for {@link Arrays2}. + * @author <a href="mailto:ch...@it...">Christian Hujer</a> + */ +public class Arrays2Test extends TestCase { + + /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + super.setUp(); + } + + /** {@inheritDoc} */ + @Override public void tearDown() throws Exception { + super.tearDown(); + } + + /** Test case for {@link Arrays2#concat(double[]...)}. */ + @SuppressWarnings({"ImplicitNumericConversion"}) + public void testConcat() throws Exception { + final byte[] data1Orig = {1, 2, 3}; + final byte[] data2Orig = {4, 5, 6, 7}; + final byte[] data1Copy = data1Orig.clone(); + final byte[] data2Copy = data2Orig.clone(); + final byte[] concatExpected = {1, 2, 3, 4, 5, 6, 7}; + final byte[] concatResult = Arrays2.concat(data1Copy, data2Copy); + assertTrue("Original arrays must be unmodified", Arrays.equals(data1Orig, data1Copy)); + assertTrue("Original arrays must be unmodified", Arrays.equals(data2Orig, data2Copy)); + assertTrue("Concatenation must correctly concatenate", Arrays.equals(concatExpected, concatResult)); + } + +} // class Arrays2Test \ No newline at end of file Property changes on: trunk/src/test/net/sf/japi/util/Arrays2Test.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |