Reputation: 2148
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
Upvotes: 1
Views: 1057
Reputation: 10404
And instead of using System.out.println
, try using Logger.info/debug/error/trace
.
They are the standard output for Play applications.
Upvotes: 2
Reputation: 81647
You are using the org.junit.Before
annotation, which is used by JUnit to run a method before a unit test execution.
In your case, you should use the play.mvc.Before
annotation instead.
Upvotes: 6