Ill finish that email now...

Im running in to a problem with unit tests when I inject my Application:


@ContextConfiguration( "classpath:junit-web-context.xml" )

> @TransactionConfiguration( transactionManager = "txManager" )
> public class CreateFirstUserPageTest extends
> AbstractJUnit4SpringContextTests
> {
> @Autowired
> private MyApplication app;
> private WicketTester tester;
>  @Autowired
> private UserRepository userRepo;
>
>
>  @Before
> public void setUp()
> {
>  tester = new WicketTester( app );
> }
>
> ....test cases here....
>
}

When I run a single test case, everything works fine.  When I run > 1, I
hit this:
java.lang.IllegalStateException: Application name can only be set once.

How do people resolve this?

Ive tried destroying the application in a tearDown method, and while the
internal applicationKeyToApplication map gets cleaned up (along with
everything else), Application.name remains set, and cant be set again on
the 2nd test execution.  Is there a better way?

Nick

Reply via email to