Unit testing using TestRestRemplate spring boot
Sample code to use TestRestTemplate in JUnit Test. package com.example.rest; import static org.junit.Assert.assertEquals; import java.util.ArrayList; import java.util.List; import org.json.JSONException; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.context.junit4.SpringRunner; import com.example.CouchBaseApplication; import com.example.model.Student; @RunWith(SpringRunner.class) @SpringBootTest(classes = CouchBaseApplication.c...