title: Why the params go through the function when i use junit?
body: <p>I want to test the controller of java-end,so I need a params from web which is request for the controller.But I am confused of map&amp;json,and the params I made is cannot use.</p>
  
  <p>the key code:</p>
  
  <pre><code>public Object updateListLoggerUser(@RequestBody Map&lt;String, Object&gt; params, Model model, HttpServletRequest request)
          throws IOException {
      if (params.get("statusEvents") == null) {
          model.addAttribute(ReturnMessage.STATUS, ReturnMessage.STATUS_NOT_OK);
          model.addAttribute(ReturnMessage.ERROR_CODE, ReturnMessage.ERROR_CODE_MESSAGE.ERROR_CODE_500);
          model.addAttribute(ReturnMessage.ERROR_MESSAGE, "No statusEvents parameter");
      }
      List&lt;HOSStatusEvent&gt; statusEvents = JSON.parseArray(JSON.toJSONString(params.get("statusEvents")),
              HOSStatusEvent.class);//I need make a params whose key is "statusEvent"
      UserSessionDto usDto = ControllerUtils.getCurrentClientAdminInfo(request);
      hourOfServiceService.generateOneDayStatusEventForUser(usDto.getUserId(), statusEvents.get(0).getShortDate(),
              statusEvents);
      try {
          hourOfServiceService.reCal(usDto.getUserId(), statusEvents.get(0).getShortDate(), 0);
      } catch (Exception e) {
          model.addAttribute(ReturnMessage.STATUS, ReturnMessage.STATUS_NOT_OK);
          model.addAttribute(ReturnMessage.ERROR_CODE, ReturnMessage.ERROR_CODE_MESSAGE.ERROR_CODE_500);
          model.addAttribute(ReturnMessage.ERROR_MESSAGE, ReturnMessage.ERROR_CODE_MESSAGE.ERROR_MESSAGE_500);
      }
      model.addAttribute(ReturnMessage.STATUS, ReturnMessage.STATUS_OK);
      return model;
  }
  </code></pre>
  
  <p>and what fields is the HOSStatusEvent model have:</p>
  
  <pre><code>private String userId;//"Jo"
  private String devId;//"car123"
  private Integer shortDate;//20160615
  private Integer startTime;//1412
  private Integer endTime;//1425
  private Integer duration;//13
  private String comments;//"some comments"
  private String location;//"Hubei China"
  private Integer status;//3
  private Integer specialType;//1
  </code></pre>
  
  <p>My params which is incorrect:</p>
  
  <pre><code>statusEvent=[{'userId': 'jo','shortDate': '20160615','startTime': '1400','endTime': '1406','duration': '6','status': '3', 'comments': 'testlistupdate','location': 'sz'},{'userId': 'jo','shortDate: '20160615','startTime': '1412','endTime': '1525','duration': '13','status': '3','comments': 'testsingleupdate','location': 'Hubei China'}]
  </code></pre>
  
  <p>this is my relevant test Code(this part only show how I mock the param)：</p>
  
  <pre><code>        params.put("statusEvents", "[{'userId':'jo','shortDate':'20160615','startTime':'1400','endTime':'1406','duration':'6','status': '3','comments':'testlistupdate','location':'sz'},{'userId':'jo','shortDate':'20160615','startTime':'1412','endTime':'1525','duration':'13','status':'3','comments':'testsingleupdate','location':'HubeiChina'}]");
      //params.put("type", "S");
      String content = JSON.toJSONString(params);
      String contentType = "application/json";
      String charset = "utf-8";
      RequestEntity requestEntity = new StringRequestEntity(content, contentType, charset);
      postMethod.setRequestEntity(requestEntity);
      httpClient.getState().addCookies(cookies);
      int status = httpClient.executeMethod(postMethod);
  </code></pre>
  
  <p>I test the function updateListLoggerUser() in the first block in this page with Junit.
  but when i debug it ,it will print an exception while in this line:</p>
  
  <pre><code>List&lt;HOSStatusEvent&gt; statusEvents = JSON.parseArray(JSON.toJSONString(params.get("statusEvents")),
          HOSStatusEvent.class);
  </code></pre>