File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Any good examples of using @Before instead of setup
 
Similar Threads
JUnit, doing it the right way, setUp & tearDown ...???
OO Calculator -- a Tutorial
DbUnit and Hibernate hbm2ddl.auto, best practices...
JUnit fixture
Comparing Species -- Need help--badly!