Skip to content
Advertisement

JUnit4 failed to load application context

I am trying to use JUnit4 for testing of my project. I have tried using JUnit5 but I cannot get this working either. I am trying to test my account controller at the momemnt. This is the full stack trace of the error I am receving

JavaScript

Here is my build.gradle:

JavaScript

}

This is the version of spring boot I am using: springBootVersion = ‘1.5.0.RELEASE’ I know this is an old version however I have not got the time to update currently.

Here is the controller code.

JavaScript

And this is the test I am trying to run:

JavaScript

I am quite new to JUnit so any help would be greatly appreicated. Also, if anyone could explain what this “failed to load application context” actually meant I would be grateful. Thank you very much

Advertisement

Answer

If read stacktrace more properly, you have this exception Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set

Add hibernate dialect to your properties. Here is a question with the same exception.

Advertisement