Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Testing POJOs & JavaBeans Using JUnit in IRAD for WebSphere7

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
7,470
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Aug 4, 2008

You can see the full JUnit Testing CBT Video here:

http://www.thebookonhibernate.com/j2ee/sunjavasamplecodetutorialsmockexams.js...

Download the Completed Solution: 04JavaBeanJUnit.ear.

http://www.thebookonhibernate.com/j2ee/vangogh/04javabeanjunit.ear

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/j2ee/index.jsp?link=03httpsessionswf

  • likes, 1 dislikes

Link to this comment:

Share to:
see all

All Comments (4)

Sign In or Sign Up now to post a comment!
  • Wow dude, your hibernate book was awesome !

    am so glad i looked at your Junit video now..so much in so less time !

  • Noisy typekey simulation sounds mars an otherwise good video...

  • Is this guy using an actual typewriter? It's soooo loud!

  • interesting

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more