Spring support JUnit quite well on that:
With the RunWith
and ContextConfiguration
annotation, things look very intuitive
@RunWith(
Here is an example that worked for me:
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.annotations.Test;
@Test
@ContextConfiguration(locations = {"classpath:applicationContext.xml"})
public class TestValidation extends AbstractTestNGSpringContextTests {
public void testNullParamValidation() {
// Testing code goes here!
}
}