コード例 #1
0
  @Test
  public void missingParameterErrorUnsubscribe() throws Exception {

    UnsubscribeContext unsubscribeContext = new UnsubscribeContext();

    mockMvc
        .perform(
            post("/ni/unsubscribeContext")
                .content(Util.json(jsonConverter, unsubscribeContext))
                .contentType(MediaType.APPLICATION_JSON)
                .header("Host", "localhost")
                .accept(MediaType.APPLICATION_JSON))
        .andExpect(status().isOk())
        .andExpect(
            MockMvcResultMatchers.jsonPath("$.statusCode.code").value(CodeEnum.CODE_471.getLabel()))
        .andExpect(
            MockMvcResultMatchers.jsonPath("$.statusCode.reasonPhrase")
                .value(CodeEnum.CODE_471.getShortPhrase()))
        .andExpect(
            MockMvcResultMatchers.jsonPath("$.statusCode.details")
                .value("The parameter subscriptionId of type String is missing in the request"));
  }
コード例 #2
0
  @Test
  public void missingParameterErrorQuery() throws Exception {

    QueryContext queryContext = new QueryContext();

    mockMvc
        .perform(
            post("/ni/queryContext")
                .content(Util.json(jsonConverter, queryContext))
                .contentType(MediaType.APPLICATION_JSON)
                .header("Host", "localhost")
                .accept(MediaType.APPLICATION_JSON))
        .andExpect(status().isOk())
        .andExpect(
            MockMvcResultMatchers.jsonPath("$.errorCode.code").value(CodeEnum.CODE_471.getLabel()))
        .andExpect(
            MockMvcResultMatchers.jsonPath("$.errorCode.reasonPhrase")
                .value(CodeEnum.CODE_471.getShortPhrase()))
        .andExpect(
            MockMvcResultMatchers.jsonPath("$.errorCode.details")
                .value("The parameter entities of type List<EntityId> is missing in the request"));
  }
コード例 #3
0
  @Test
  public void missingParameterErrorUpdate() throws Exception {

    UpdateContext updateContext = Util.createUpdateContextTempSensor(0);
    updateContext.setUpdateAction(null);

    mockMvc
        .perform(
            post("/ni/updateContext")
                .content(Util.json(jsonConverter, updateContext))
                .contentType(MediaType.APPLICATION_JSON)
                .header("Host", "localhost")
                .accept(MediaType.APPLICATION_JSON))
        .andExpect(status().isOk())
        .andExpect(
            MockMvcResultMatchers.jsonPath("$.errorCode.code").value(CodeEnum.CODE_471.getLabel()))
        .andExpect(
            MockMvcResultMatchers.jsonPath("$.errorCode.reasonPhrase")
                .value(CodeEnum.CODE_471.getShortPhrase()))
        .andExpect(
            MockMvcResultMatchers.jsonPath("$.errorCode.details")
                .value("The parameter updateAction of type string is missing in the request"));
  }