From the course: Java EE 7: Web Services

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Test web services

Test web services - Java EE Tutorial

From the course: Java EE 7: Web Services

Start my 1-month free trial

Test web services

- [Instructor] If you've been developing for a while, then you know the importance of testing and having defined unit and integration tests for the applications that you develop to ensure that new changes don't break existing code and that all individual components work together seamlessly. So let's look at the steps necessary for incorporating tests in a JAX-RS based web service. So the first thing I've done, I've opened the project in IntelliJ and I've navigated to the POM.xml Maven file and I've added this dependency here for JUnit. And so next, let's go to our test. So our ApplicationResourceTest.java file, notice it's found in the source test package. And so let's look at this. Let's expand that a bit. On line 16, there is the testGetAllApplications method. And so let's take a look at that. In this case, we are using the Rest API client to fire an http request, which moves a bit into the realm of integration testing. So on lines 19 through 22, I'm invoking the get call here on…

Contents