Loading...

Testing POJOs & JavaBeans Using JUnit in IRAD for WebSphere7

9,993 views

Loading...

Loading...

Transcript

The interactive transcript could not be loaded.

Loading...

Loading...

Rating is available when the video has been rented.
This feature is not available right now. Please try again later.
Published on Aug 4, 2008

You can see the full JUnit Testing CBT Video here:

http://www.thebookonhibernate.com/j2e...

Download the Completed Solution: 04JavaBeanJUnit.ear.

http://www.thebookonhibernate.com/j2e...

The junit.jar file must be on your classpath for you to bring this ear file in and have the JUnit tests compile - just so you know.

Scroll to the bottom of the page for pertinent code snippets.

Running JUnit Test on JavaBeans

This free, multimedia tutorial shows you how to use IBM's Rational Application Developer (IRAD) 6.0 to create and run a JUnit test on a simple JavaBean.

If you found something helpful here, please do your part and help support the site. Link to us, buy some books, support our sponsors, tell your developer friends about us, and remember: Happy Java!

package com.examscam.common.test;

import com.examscam.common.Timer;

import junit.framework.TestCase;




public class TimerTest extends TestCase {

Timer t;

protected void setUp() throws Exception {
super.setUp();
t = new Timer();
t.start();
}


protected void tearDown() throws Exception {
super.tearDown();
t = null;
}

public void testStart() {
assertTrue("Timer isn't staring properly.",
t.getStartTime() <= System.currentTimeMillis());
}

public void testGetElapsedTime() {
assertTrue("Time Travel is not allowed", t.getElapsedTime() >= 0);
}

public void testReset() {
long originalStartTime = t.getStartTime();
t.reset();
assertTrue("Problem with reset", originalStartTime <= t.getStartTime());
}
}


Please check out my SCJA Java Certification Mock Exam website: http://www.scja.com/associate/ And for Hibernate and JPA tutorials, check out: http://www.thebookonhibernate.com http://www.thebookonhibernate.com/j2e...

  • Category

  • License

    • Standard YouTube License

Loading...

When autoplay is enabled, a suggested video will automatically play next.

Up next


to add this to Watch Later

Add to

Loading playlists...