File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cross reference (function) Junit test

 
Adrien Ruffie
Ranch Hand
Posts: 92
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33700
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your test is fine. It is ok to call two methods in the same test when they are testing a scenario as yours is.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic