Developer's Daily Java Education - Test Projects
  front page | java | perl | unix | DevDirectory
   
Front Page
Java
Education
   
 


import junit.framework.

public class PhoneNumberConverterTest extends TestCase
{

  //--------------------------------------------------------------------------------------------------//

  protected void setUp()
  {
    System.err.println( "running setUp" );
  }

  //--------------------------------------------------------------------------------------------------//

  protected void tearDown()
  {
    System.err.println( "running tearDown" );
  }

  //--------------------------------------------------------------------------------------------------//

  public void testLowercaseChars()
  {
    System.err.println( "running testLowercaseChars" );
    int i = PhoneNumberConverter.convertCharacterToNumber('a');
    this.assert("char a returns a 2", (i == 2) );

    i = PhoneNumberConverter.convertCharacterToNumber('d');
    this.assert("char d returns a 3", (i == 3) );
  }

  //--------------------------------------------------------------------------------------------------//

  public void testUppercaseChars()
  {
    System.err.println( "running testUppercaseChars" );
    int i = PhoneNumberConverter.convertCharacterToNumber('A');
    this.assertEquals("asserting that 'A' == 2", 2, i);
  }

  //--------------------------------------------------------------------------------------------------//

  public static void main(String args[])
  {
    junit.textui.TestRunner.run(PhoneNumberConverterTest.class);
  }

  //--------------------------------------------------------------------------------------------------//

  public PhoneNumberConverterTest(String name)
  {
    super(name);
  }

  //--------------------------------------------------------------------------------------------------//

  public static Test suite()
  {
    TestSuite suite = new TestSuite();

    // run tests manually
    //suite.addTest( new PhoneNumberConverterTest("testLowercaseChars") );
    //suite.addTest( new PhoneNumberConverterTest("testUppercaseChars") );
    //return suite;

    // run tests dynamically
    return new TestSuite(PhoneNumberConverterTest.class);
  }




}

Copyright 1998-2003 DevDaily Interactive, Inc.
All Rights Reserved.