Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2006

Tip: Looking for answers? Try searching our database.

junit testing

Thread view: 
dijeshharidas@gmail.com - 05 Apr 2006 09:32 GMT
package com.ge.nbc.legal.strata.util;

import java.util.Date;
import java.text.SimpleDateFormat;
import java.text.DateFormat;
THIS IS A JAVA PROGRAM.I HAVE TO CREATE A JUNIT TEST CLASS FOR THIS
USING DIFFRENT DATE FORMATS AND TEST IT.PLEASE HELP.

public class StrataUtil {

    public String convertDateToString(Date dateValue) {
        DateFormat dateFormatObject = new SimpleDateFormat("MM/dd/yyyy");
        String strFormat = dateFormatObject.format(dateValue);
        return strFormat;
    }

    public Object parse(String string) {
        // TODO Auto-generated method stub
        return null;
    }

    public String format(Object object) {
        // TODO Auto-generated method stub
        return null;
    }
}
James McGill - 05 Apr 2006 11:10 GMT
> package com.ge.nbc.legal.strata.util;
>
[quoted text clipped - 22 lines]
>     }
> }

Here's where you start:

/**
* File: StrataUtilTest.java <p>
* Created: Apr 5, 2006 <p>
*/
package com.ge.nbc.legal.strata.util;

import java.util.Date;

import junit.framework.TestCase;

/**
* TestCase automatically generated by Eclipse
* @version $Id: $
*/
public class StrataUtilTest extends TestCase {

    private StrataUtil fixture;
   
    public static void main(String[] args) {
        junit.textui.TestRunner.run(StrataUtilTest.class);
    }

    /**
    * Constructor for StrataUtilTest.
    * @param name
    */
    public StrataUtilTest(String name) {       
        super(name);
    }

    /*
    * @see TestCase#setUp()
    */
    protected void setUp() throws Exception {
        super.setUp();
        fixture = new StrataUtil();
    }

    /*
    * @see TestCase#tearDown()
    */
    protected void tearDown() throws Exception {
        super.tearDown();
    }

    /*
    * Test method for 'com.ge.nbc.legal.strata.util.StrataUtil.convertDateToString(Date)'
    */
    public void testConvertDateToString() {
       
        String dateString = fixture.convertDateToString(new Date());
       
        //
        //
        // Your work starts here.
        //
        //   
   
        fail();
    }

    /*
    * Test method for 'com.ge.nbc.legal.strata.util.StrataUtil.parse(String)'
    */
    public void testParse() {
        fail();
    }

    /*
    * Test method for 'com.ge.nbc.legal.strata.util.StrataUtil.format(Object)'
    */
    public void testFormat() {
        fail();
    }

}


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.