The problem was that the test case was creating AnnotApplicationContextMock
before creating the WebApplication itself. The following code worked for me:
MyApplication webApp = new MyApplication()
{
@Override
public void init() {
addComponentInstantiationListener(new
SpringComponentInjector(this, new AnnotApplicationContextMock(), false));
}
};
Alec
On Mon, Dec 28, 2009 at 11:01 AM, Alec Swan <[email protected]> wrote:
> I just upgraded from Wicket 1.4.2 to Wicket 1.4.5 and started receiving the
> following exceptions from my Unit test.
>
> Is this a known issue or do I need to change my test?
>
> Thanks.
>
> org.apache.wicket.WicketRuntimeException: *There is no application
> attached to current thread main*
> at org.apache.wicket.Application.get(Application.java:179)
> at
> org.apache.wicket.injection.web.InjectorHolder.setInjector(InjectorHolder.java:88)
> at
> org.apache.wicket.spring.injection.annot.test.AnnotApplicationContextMock.<init>(AnnotApplicationContextMock.java:61)
> at
> com.galecsy.lrm.wicket.referral.ReferralFormTest.beforeTest(ReferralFormTest.java:43)
> at
> org.springframework.test.context.junit4.SpringMethodRoadie.runBefores(SpringMethodRoadie.java:273)
> at
> org.springframework.test.context.junit4.SpringMethodRoadie$RunBeforesThenTestThenAfters.run(SpringMethodRoadie.java:332)
> at
> org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(SpringMethodRoadie.java:217)
> at
> org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringMethodRoadie.java:197)
> at
> org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMethodRoadie.java:143)
> at
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:160)
> at
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
>
>
>