wood burning stoves 2.0*
The moose likes Testing and the fly likes Any good examples of using @Before instead of setup Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Any good examples of using @Before instead of setup" Watch "Any good examples of using @Before instead of setup" New topic
Author

Any good examples of using @Before instead of setup

Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 573
In all the examples I have seen its just

@Before
public void setUp(){
}

But just using @Before resualts in a comple error, its expecting a value after before. Its not the test that needs to be carried out or the method the test is testing.
Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 573
Found the problem was using import org.aspectj.lang.annotation.Before.

instead of import org.junit.Before;

If anyone knows of any good tutorials on using the import org.aspectj.lang.annotation.Before. can you link it here thanks.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

There are examples in the AspectJ documentation; the value is a pointcut expression, and the annotated method is what'll be run.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Any good examples of using @Before instead of setup