aspose file tools*
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
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: 89
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: 29257
    
140

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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Cross reference (function) Junit test
 
Similar Threads
join() and completely stopping a thread
Thread and variable value question?
Removing objects (Threads)
Question about Games in Andorid
Simulating Power Supply Unit.