junit testing

D

dijeshharidas

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;
}
}
 
J

James McGill

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;
}
}


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();
}

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top