I’m running play application.
I have
import org.junit.Before;
public class Frontpage extends Controller {
@Before
private static void commonData() {
Map cacheMap = Cache.get("login_det",Map.class);
System.out.println("commonData");
if(cacheMap!=null)
{
renderArgs.put("login_det", cacheMap);
System.out.println("renderArgs"+renderArgs.toString());
}
}
}
But commonData is never printed in my console. How can i check @Before is working
You are using the
org.junit.Beforeannotation, which is used by JUnit to run a method before a unit test execution.In your case, you should use the
play.mvc.Beforeannotation instead.