Joe
Joe

Reputation: 777

Good Way to Test Spring Services With Method Level Annotaions

I have a Spring service I want to test that uses the @Validated annotation on one of its method parameters. I would like to test it in the Spring container, but I am not sure if that is the best way. If testing in the container is the best solution for my situation, I would like to know how to run it in the container without loading my complete configuration. Any thoughts?

Upvotes: 0

Views: 77

Answers (1)

Joe
Joe

Reputation: 777

I ended up using the Spring Test Framework. I am using the standalone and the web application context of the mock MVC to test my annotations.

Spring 3.2.4 Test Framework http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/testing.html

Configuration Example http://www.petrikainulainen.net/programming/spring-framework/unit-testing-of-spring-mvc-controllers-configuration/

Upvotes: 1

Related Questions