Junit before class ( non static )

Posted by Roman on Stack Overflow See other posts from Stack Overflow or by Roman
Published on 2010-05-13T09:22:09Z Indexed on 2010/05/13 9:24 UTC
Read the original article Hit count: 192

Filed under:
|

Are there any best practices to get Junit execute a function once in a test file , and it should also not be static.

like @BeforeClass on non static function?

Here is an ugly solution :

@Before void init(){
    if (init.get() == false){
        init.set(true);
        // do once block
    }
}

well this is something i dont want to do , and i am looking for an integrated junit solution.

© Stack Overflow or respective owner

Related posts about java

Related posts about junit