java - test case for spring rest controller for post mapping -


i have spring boot application controller logic shown below

@restcontroller public class compare {     @postmapping(path = "/soon")     public boolean compare (@requestbody string json,  @requestheader(value="c_code") string old  )     {         hash hashobj=new hash();         string new=hashobj.(json);         if(old.equals(new))             return true;         else             return false;      }  } 

through postman posting string requestbody , string requestheader. string requestbody been sent function called sha() , returned value function compared string of requestheader. tried writing test case thing got errors.

@autowired     private webapplicationcontext webapplicationcontext;      private mockmvc mockmvc;      @before     public void setup() {         mockmvc = mockmvcbuilders.webappcontextsetup(webapplicationcontext).build();     }      @test     public void testemployee() throws exception {         // me write test case here       } 


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -