This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Modern JavaScript for the Impatient and have Cay Horstmann on-line!
See this thread for details.
Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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

 
Bartender
Posts: 1944
13
  • Mark post as helpful
  • send pies
  • 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: 1944
13
  • Likes 2
  • Mark post as helpful
  • send pies
  • 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.
 
Why is the word "abbreviation" so long? And this ad is so short?
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic