Results 1 to 2 of 2

Thread: Junit test

  1. #1
    alice is offline Member
    Join Date
    Jun 2008
    Posts
    1
    Rep Power
    0

    Default Junit test

    Java Code:
    _*A class called HWTime has been designed to hold details of time . The method signature have been designed :*_
    
    {code}
    //constructor intialiazs to midnight (00:00)
    Public HWTime ()
    
    //constructor intialises time to hours and minutes provided 
    Public HWTime (int hours , int mins)
    
    //the String is supplied in the formal hh:mm
    //eg 09:30,23:07
    Public setTime24(String time)
    
    //returns the time in minutes since midnight
    //eg.g 09:30 => 9 *60 + 30 = 570
    Public int getTimeInMin()
    
    //returns the time as string in the format hh:mm
    //eg .09:30,23:07
    Public int getTime24() 
    
    
    //_The Question_ 
    
    //// a) explain how Junit can be used to create a set of test for this class 
    
    ///My Answer
    public boolean equals(Object otherObject) {	
        
    MyTime otherDate = (MyTime) otherObject;
        if ( (this.hours == othertime.hours)  
             && (this.mins == otherDate.mins))
    return true;
    else 
    return false;
    
        
        }
    
    
    	/////b) Write Junit Test For this Method
    {code}
    plz help me to answer this question

  2. #2
    ferranb is offline Member
    Join Date
    Jun 2008
    Posts
    22
    Rep Power
    0

Similar Threads

  1. Junit
    By Azndaddy in forum New To Java
    Replies: 6
    Last Post: 06-15-2008, 07:47 AM
  2. Replies: 0
    Last Post: 04-05-2008, 01:38 AM
  3. Testing JUnit PDE with Ant
    By keynan in forum Eclipse
    Replies: 0
    Last Post: 02-15-2008, 12:35 AM
  4. TRying to use jUnit for Tesing
    By sandor in forum New To Java
    Replies: 3
    Last Post: 04-19-2007, 12:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •