title: How to junit return type of a method in spring mvc controller
body: <p>I am doing junit on my Spring MVC controller - </p>
  
  <pre><code>@RequestMapping(value = "index", method = RequestMethod.GET)
      public HashMap&lt;String, String&gt; handleRequest() {
      HashMap&lt;String, String&gt; model = new HashMap&lt;String, String&gt;();
      String name = "Hello World";
      model.put("greeting", name);
  
      return model;
  }
  </code></pre>
  
  <p>And below is my junit for the above method -</p>
  
  <pre><code>public class ControllerTest {
  
      private MockMvc mockMvc;
  
      @Before
      public void setup() throws Exception {
      this.mockMvc = standaloneSetup(new Controller()).build();
      }
  
      @Test
      public void test01_Index() {
  
      try {
          mockMvc.perform(get("/index")).andExpect(status().isOk());
  
      } catch (Exception e) {
          e.printStackTrace();
      }
      }
  }
  </code></pre>
  
  <p>Above junit works fine.. </p>
  
  <p>But my question is how do I junit the return type of <code>handleRequest</code> which is returning a <code>HashMap</code> with key and value pair.. How do I verify that it is returning <code>Hello World</code>? Is there any method to do that as well?</p>