title: Test the Spring Boot Rest API Post Method
body: <p>I completely new to Junit and I have to write Junit Test case for my Rest Controller but I am not getting from where should I start. Any help would be really appreciated.</p>
  
  <p>This is My Rest Controller class.</p>
  
  <pre><code>@RestController
  public class RecognitionController {
  
      private FrameDecoder frameDecoder;
      private TagEncoder tagEncoder;
      private RecognitionService recognitionService;
  
      @Autowired
      public RecognitionController(FrameDecoder frameDecoder, TagEncoder tagEncoder,
          RecognitionService recognitionService) {
  
          this.frameDecoder = frameDecoder;
          this.tagEncoder = tagEncoder;
          this.recognitionService = recognitionService;
      }
  
      /**
       * 
       * @param take the input as Json Frame and map the output at api/detection Url.
       * @return List of Json tag in the Http response.
       */
      @RequestMapping(value = "/api/detection", method = RequestMethod.POST)
      public List&lt;JsonTag&gt; analyseframe(@RequestBody JsonFrame frame) {
          SimpleFrame simpleFrame = frameDecoder.decodeFrame(frame);
          List&lt;OrientedTag&gt; orientedTags = recognitionService.analyseFrame(simpleFrame);
          return tagEncoder.encodeTag(orientedTags);
      }
  }
  </code></pre>