From: <chr...@us...> - 2006-06-28 21:33:23
|
Revision: 220 Author: christianhujer Date: 2006-06-28 14:33:14 -0700 (Wed, 28 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=220&view=rev Log Message: ----------- Added unit test for Size2D. Added Paths: ----------- trunk/src/test/net/sf/gridarta/Size2DTest.java Added: trunk/src/test/net/sf/gridarta/Size2DTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/Size2DTest.java (rev 0) +++ trunk/src/test/net/sf/gridarta/Size2DTest.java 2006-06-28 21:33:14 UTC (rev 220) @@ -0,0 +1,67 @@ +package test.net.sf.gridarta; + +import net.sf.gridarta.Size2D; +import junit.framework.TestCase; + +/** + * Test for {@link Size2D}. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class Size2DTest extends TestCase { + + /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + super.setUp(); + } + + /** {@inheritDoc} */ + @Override public void tearDown() throws Exception { + super.tearDown(); + } + + /** Test case for {@link Size2D#Size2D(int, int)}. */ + public void testSize2D() throws Exception { + final Size2D size = new Size2D(100, 200); + assertEquals("width MUST be stored", 100, size.getWidth()); + assertEquals("height MUST be stored", 200, size.getHeight()); + } + + /** Test case for {@link Size2D#equals(Object)}. */ + public void testEquals() throws Exception { + final Size2D size1 = new Size2D(100, 200); + final Size2D size2 = new Size2D(100, 200); + final Size2D size3 = new Size2D(100, 200); + final Size2D differWidth = new Size2D(50, 200); + final Size2D differHeight = new Size2D(100, 80); + final Size2D differBoth = new Size2D(50, 80); + assertEquals("Sizes with identical width and height MUST be equal.", size1, size2); + assertEquals("Sizes with identical width and height MUST be equal.", size1, size3); + assertEquals("Sizes with identical width and height MUST be equal.", size2, size1); + assertEquals("Sizes with identical width and height MUST be equal.", size2, size3); + assertEquals("Sizes with identical width and height MUST be equal.", size3, size1); + assertEquals("Sizes with identical width and height MUST be equal.", size3, size2); + assertFalse("Sizes with different width or height MUST be unequal", size1.equals(differBoth)); + assertFalse("Sizes with different width or height MUST be unequal", size1.equals(differWidth)); + assertFalse("Sizes with different width or height MUST be unequal", size1.equals(differHeight)); + } + + /** Test case for {@link Size2D#hashCode()}. */ + public void testHashCode() throws Exception { + final Size2D size1 = new Size2D(100, 200); + final Size2D size2 = new Size2D(100, 200); + assertEquals("Equal sizes MUST return the same hashCode.", size1.hashCode(), size2.hashCode()); + } + + /** Test case for {@link Size2D#getWidth()}. */ + public void testGetWidth() throws Exception { + final Size2D size = new Size2D(100, 200); + assertEquals("width MUST be stored", 100, size.getWidth()); + } + + /** Test case for {@link Size2D#getHeight()}. */ + public void testGetHeight() throws Exception { + final Size2D size = new Size2D(100, 200); + assertEquals("height MUST be stored", 200, size.getHeight()); + } + +} // class Size2DTest \ No newline at end of file Property changes on: trunk/src/test/net/sf/gridarta/Size2DTest.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. |