POSTS

Play - Junit runtimeException no started application

Problem: 

“RuntimeException: There is no started application”
<![CDATA[ @Test public void test1() { (…) assertEquals(…); ]]>

Solution:

<![CDATA[ (…) import static play.test.Helpers.fakeApplication; import static play.test.Helpers.running; (…) @Test public void test1() { running(fakeApplication(), new Runnable() { public void run() { subscriber.set(“key_1”, “value_1”); subscriber.set(“key_2”, “value_2”); subscriber.set(“key_3”, “value_3”); assertEquals(subscriber.get(“key_1”),“value_1”); ]]>
SyntaxHighlighter.highlight();