when i am trying to run the controller Testing in Spring-boot version 1.5.3 Release using the Spring-Boot-Test I am geting the Error Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletException
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.test.context.junit4.SpringRunner;
import com.hanselnpetal.domain.CustomerContact;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@AutoConfigureMockMvc
public class ContactsManagementControllerIntegrationTest {
@Autowired
ContactsManagementController contactsManagementController;
@Test
public void testAddContactHappyPath() {
CustomerContact aContact = new CustomerContact();
aContact.setFirstName("Jenny");
aContact.setLastName("Johnson");
// POST our CustomerContact form bean to the controller; check the outcome
String outcome = contactsManagementController.processAddContactSubmit(aContact);
// Assert THAT the outcome is as expected
assertThat(outcome, is(equalTo("success")));
}
}
I am running the class ContactsManagementControllerIntegrationTest.java using (eclipse) the right click on the file and run as junit . any help appreciated.