wood burning stoves 2.0*
The moose likes Testing and the fly likes Cross reference (function) Junit test Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Cross reference (function) Junit test" Watch "Cross reference (function) Junit test" New topic
Author

Cross reference (function) Junit test

Adrien Ruffie
Ranch Hand

Joined: Jan 14, 2009
Posts: 90
Hello all, my problem is:

I have two functions in my class which I would like to test, start(), isRunning()

But for the function which test start() method I use isRunning() to validate my test,
and for the function which test isRunning() methid I use start() too.

example:

@Test
public void testStart() {
assertFalse(server.isRunning());

server.start();

assertTrue(server.isRunning());
}

Do you have an idea for best pratice and how to test cross reference in unit test ?

Thank all


SCJP 5, SCDJWS 5
http://adrien-ruffie.blogspot.com
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30138
    
150

Your test is fine. It is ok to call two methods in the same test when they are testing a scenario as yours is.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
Consider Paul's rocket mass heater.
 
subject: Cross reference (function) Junit test
 
Similar Threads
Thread and variable value question?
Question about Games in Andorid
join() and completely stopping a thread
Removing objects (Threads)
Simulating Power Supply Unit.