Junit

In this REST Assured tutorial, I am going to share with you how to evaluate the JSON content returned in the Response Body of HTTP Response. JSON Content Returned in Response Body Let’s say we have a RESTful Web Service endpoint that returns user details of the following structure: { “userId”: “Y3vWa8QwjK0DW6NmvB4HsXIV9gHg1q”, “firstName”: “Sergey”, “lastName”:…

Read More REST Assured Evaluate JSON Response Body

When writing a JUnit test there are different ways to test for expected exception and below I am going to share with you three different ways. Using @Test Expected Attribute One way to test for expected exceptions is to use the @Test’s expected attribute to specify that the method below should throw an exception specified by…

Read More JUnit Test Expected Exception Example

With Mockito we can Mock an object, stub some of it’s methods but not the other and still be able to call a real method of this stubbed object. In the code example below I am going to share with you how to call a real method of a mocked object using Mockito’s thenCallRealMethod(). In…

Read More Use Mockito’s thenCallRealMethod() to Call a Real Method

Earlier I’ve published a blog post on now to create a RESTful Web Service(JAX-RS) to accept JSON payload with user profile details and how to save user profile details into a MySQL database using Java Hibernate framework. In this blog post I am going to share with you how to test(using JUnit and Mockito) it’s Service…

Read More Test RESTful Web Service with JUnit and Mockito