• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Junit 5 does not support @ContextConfiguration (locations = some.xml) ?

 
Bartender
Posts: 2266
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I am migrating my instructor's Junit 4 Spring Framework test to Junit 5.
This is what I have:



When I ran the test, I use a debugger to find out that the applicationService bean is not autowired. It is null.

But when I switch it back to Junit 4, @RunWith(SpringRunner.class) , the test works fine.
So, I think Junit 5 does not support reading xml configuration file anymore.

For reference, I attach my file structure and pom's related dependency.

If any of you have suggestion, please advice me.  Thanks.
thePom.JPG
[Thumbnail for thePom.JPG]
fileStructure.JPG
[Thumbnail for fileStructure.JPG]
 
Himai Minh
Bartender
Posts: 2266
13
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can answer my own question now.
In the test, I should use @org.junit.jupiter.api.Test instead of @org.junit.Test.
Now, I can migrate the code from Junit 4 to Junit 5.
 
reply
    Bookmark Topic Watch Topic
  • New Topic