Advertisement
jdalbey

RopeTest.java

Apr 26th, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.04 KB | None | 0 0
  1. /**
  2.  * The test class RopeTest.
  3.  *
  4.  * @author  (your name)
  5.  * @version (a version number or a date)
  6.  */
  7. public class RopeTest extends junit.framework.TestCase
  8. {
  9.     /**
  10.      * Default constructor for test class RopeTest
  11.      */
  12.     public RopeTest()
  13.     {
  14.     }
  15.  
  16.     /**
  17.      * Sets up the test fixture.
  18.      *
  19.      * Called before every test case method.
  20.      */
  21.     protected void setUp()
  22.     {
  23.     }
  24.  
  25.     public void testGetName()
  26.     {
  27.         Rope rope1 = new Rope("Flash", 6);
  28.         assertEquals("Flash", rope1.getName());
  29.         Rope rope2 = new Rope("Zoom", 5);
  30.         // This assert uses the optional message parameter
  31.         assertEquals("Test name accessor failed.", "Varoom", rope2.getName());
  32.     }
  33.    
  34.     public void testToString()
  35.     {
  36.         Rope rope1 = new Rope("Guide", 9);
  37.         assertEquals("Guide 9", rope1.toString());
  38.     }
  39.  
  40.     public void testEquals()
  41.     {
  42.         Rope rope1 = new Rope("Alpha", 5);
  43.         Rope rope2 = new Rope("Alpha", 5);
  44.         assertEquals(rope1, rope2);
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement