When running a JUnit test, using IntelliJ IDEA, I get

How can I correct this?
- Using SDK 1.7
- Module language level is 1.7
Maven build works fine. (That’s why I believe this in IDEA configuration issue)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Most likely you have incorrect compiler options imported from Maven here:
Also check project and module bytecode (target) version settings outlined on the screenshot.
Other places where the source language level is configured:
Maven default language level is 1.5 (5.0), you will see this version as the Module language level on the screenshot above.
This can be changed using maven-compiler-plugin configuration inside
pom.xml:or
IntelliJ IDEA will respect this setting after you Reimport the Maven project in the Maven Projects tool window: