Example usage for java.util HashMap remove

List of usage examples for java.util HashMap remove

Introduction

In this page you can find the example usage for java.util HashMap remove.

Prototype

public V remove(Object key) 

Source Link

Document

Removes the mapping for the specified key from this map if present.

Usage

From source file:com.ecofactor.qa.automation.api.ReportsAPITest.java

/**
 * Invalid user savings./*from   www . jav  a2 s .  co  m*/
 */
@Test(groups = { "sanity1" })
public void invalidUserSavings() {

    HashMap<String, String> params = getNotAccumulatedParams(5);
    params.remove(ReportsAPIConfig.ACCUMULATED);
    params.put(ReportsAPIConfig.ACCUMULATED, "");
    String id = reportsAPIConfig.get(ReportsAPIConfig.USER_ID);
    String content = HttpUtil.get(getUserSavingsURL(id), params, 500);
    JSONObject object = JsonUtil.parseObject(content);
    Assert.assertNotNull(object);
    Assert.assertNotNull(object.get(reportsAPIConfig.get(ReportsAPIConfig.ERROR_MSG)));
    JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(ReportsAPIConfig.ERROR_MSG));
    for (Object mesg : mesgs) {
        Assert.assertTrue(mesg.toString().startsWith(reportsAPIConfig.get(ReportsAPIConfig.INTERNAL_ERROR)));
    }
}

From source file:com.ecofactor.qa.automation.api.ReportsAPITest.java

/**
 * Missing start date user savings./* w ww.ja v a2  s.com*/
 */
@Test(groups = { "sanity1" })
public void missingStartDateUserSavings() {

    HashMap<String, String> params = getNotAccumulatedParams(5);
    params.remove(ReportsAPIConfig.START_DATE);
    String id = reportsAPIConfig.get(ReportsAPIConfig.USER_ID);
    String content = HttpUtil.get(getUserSavingsURL(id), params, 400);
    JSONObject object = JsonUtil.parseObject(content);
    Assert.assertNotNull(object);
    Assert.assertNotNull(object.get(reportsAPIConfig.get(ReportsAPIConfig.ERROR_MSG)));
    JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(ReportsAPIConfig.ERROR_MSG));
    for (Object mesg : mesgs) {
        Assert.assertEquals(mesg.toString().trim(),
                reportsAPIConfig.get(ReportsAPIConfig.SVG_START_DATE_ERROR));
    }
}

From source file:com.ecofactor.qa.automation.api.HttpsReportsAPITest.java

/**
 * Missing start date location usage months.
 *///from   w ww. ja  v a  2  s  .  c  o m
@Test(groups = { "sanity1" })
public void missingStartDateLocationUsageDays() {

    HashMap<String, String> params = getDayParams();
    params.remove(HttpsReportsAPIConfig.START_DATE);
    String id = reportsAPIConfig.get(HttpsReportsAPIConfig.LOCATION_ID);
    String content = HttpsUtil.get(getLocationUsageURL(id), params, 400);
    JSONObject object = JsonUtil.parseObject(content);
    Assert.assertNotNull(object);
    Assert.assertNotNull(object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG)));
    JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG));
    for (Object mesg : mesgs) {
        Assert.assertEquals(mesg.toString().trim(),
                reportsAPIConfig.get(HttpsReportsAPIConfig.USAGE_START_DATE_ERROR));
    }
}

From source file:com.ecofactor.qa.automation.api.HttpsReportsAPITest.java

/**
 * Missing end date location usage days.
 *///from   w  w  w .  j a  v a2s . co  m
@Test(groups = { "sanity1" })
public void missingEndDateLocationUsageDays() {

    HashMap<String, String> params = getDayParams();
    params.remove(HttpsReportsAPIConfig.END_DATE);
    String id = reportsAPIConfig.get(HttpsReportsAPIConfig.LOCATION_ID);
    String content = HttpsUtil.get(getLocationUsageURL(id), params, 400);
    JSONObject object = JsonUtil.parseObject(content);
    Assert.assertNotNull(object);
    Assert.assertNotNull(object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG)));
    JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG));
    for (Object mesg : mesgs) {
        Assert.assertEquals(mesg.toString().trim(),
                reportsAPIConfig.get(HttpsReportsAPIConfig.USAGE_END_DATE_ERROR));
    }
}

From source file:com.ecofactor.qa.automation.api.HttpsReportsAPITest.java

/**
 * Missing start date user usage days.//from  ww w . j av a 2  s  .c  o m
 */
@Test(groups = { "sanity1" })
public void missingStartDateUserUsageDays() {

    HashMap<String, String> params = getDayParams();
    params.remove(HttpsReportsAPIConfig.START_DATE);
    String id = reportsAPIConfig.get(HttpsReportsAPIConfig.USER_ID);
    String content = HttpsUtil.get(getUserUsageURL(id), params, 400);
    JSONObject object = JsonUtil.parseObject(content);
    Assert.assertNotNull(object);
    Assert.assertNotNull(object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG)));
    JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG));
    for (Object mesg : mesgs) {
        Assert.assertEquals(mesg.toString().trim(),
                reportsAPIConfig.get(HttpsReportsAPIConfig.USAGE_START_DATE_ERROR));
    }
}

From source file:com.ecofactor.qa.automation.api.HttpsReportsAPITest.java

/**
 * Missing end date user usage days.//from www  . j a va 2  s.  c  o  m
 */
@Test(groups = { "sanity1" })
public void missingEndDateUserUsageDays() {

    HashMap<String, String> params = getDayParams();
    params.remove(HttpsReportsAPIConfig.END_DATE);
    String id = reportsAPIConfig.get(HttpsReportsAPIConfig.USER_ID);
    String content = HttpsUtil.get(getUserUsageURL(id), params, 400);
    JSONObject object = JsonUtil.parseObject(content);
    Assert.assertNotNull(object);
    Assert.assertNotNull(object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG)));
    JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG));
    for (Object mesg : mesgs) {
        Assert.assertEquals(mesg.toString().trim(),
                reportsAPIConfig.get(HttpsReportsAPIConfig.USAGE_END_DATE_ERROR));
    }
}

From source file:com.ecofactor.qa.automation.api.HttpsReportsAPITest.java

/**
 * Missing start date location usage hours.
 *//*from w ww.  ja va 2  s.  c om*/
@Test(groups = { "sanity1" })
public void missingStartDateLocationUsageHours() {

    HashMap<String, String> params = getHourParams();
    params.remove(HttpsReportsAPIConfig.START_DATE);
    String id = reportsAPIConfig.get(HttpsReportsAPIConfig.LOCATION_ID);
    String content = HttpsUtil.get(getLocationUsageURL(id), params, 400);
    JSONObject object = JsonUtil.parseObject(content);
    Assert.assertNotNull(object);
    Assert.assertNotNull(object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG)));
    JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG));
    for (Object mesg : mesgs) {
        Assert.assertEquals(mesg.toString().trim(),
                reportsAPIConfig.get(HttpsReportsAPIConfig.USAGE_START_DATE_ERROR));
    }
}

From source file:com.ecofactor.qa.automation.api.HttpsReportsAPITest.java

/**
 * Missing end date location usage hours.
 *//*from  ww  w.j  av a2  s. co  m*/
@Test(groups = { "sanity1" })
public void missingEndDateLocationUsageHours() {

    HashMap<String, String> params = getHourParams();
    params.remove(HttpsReportsAPIConfig.END_DATE);
    String id = reportsAPIConfig.get(HttpsReportsAPIConfig.LOCATION_ID);
    String content = HttpsUtil.get(getLocationUsageURL(id), params, 400);
    JSONObject object = JsonUtil.parseObject(content);
    Assert.assertNotNull(object);
    Assert.assertNotNull(object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG)));
    JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG));
    for (Object mesg : mesgs) {
        Assert.assertEquals(mesg.toString().trim(),
                reportsAPIConfig.get(HttpsReportsAPIConfig.USAGE_END_DATE_ERROR));
    }
}

From source file:com.ecofactor.qa.automation.api.HttpsReportsAPITest.java

/**
 * Missing start date user usage hours./*from  w w w .jav a  2 s . c o m*/
 */
@Test(groups = { "sanity1" })
public void missingStartDateUserUsageHours() {

    HashMap<String, String> params = getHourParams();
    params.remove(HttpsReportsAPIConfig.START_DATE);
    String id = reportsAPIConfig.get(HttpsReportsAPIConfig.USER_ID);
    String content = HttpsUtil.get(getUserUsageURL(id), params, 400);
    JSONObject object = JsonUtil.parseObject(content);
    Assert.assertNotNull(object);
    Assert.assertNotNull(object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG)));
    JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG));
    for (Object mesg : mesgs) {
        Assert.assertEquals(mesg.toString().trim(),
                reportsAPIConfig.get(HttpsReportsAPIConfig.USAGE_START_DATE_ERROR));
    }
}

From source file:com.ecofactor.qa.automation.api.HttpsReportsAPITest.java

/**
 * Missing end date user usage hours.//from  w ww . j a v  a2s . co m
 */
@Test(groups = { "sanity1" })
public void missingEndDateUserUsageHours() {

    HashMap<String, String> params = getHourParams();
    params.remove(HttpsReportsAPIConfig.END_DATE);
    String id = reportsAPIConfig.get(HttpsReportsAPIConfig.USER_ID);
    String content = HttpsUtil.get(getUserUsageURL(id), params, 400);
    JSONObject object = JsonUtil.parseObject(content);
    Assert.assertNotNull(object);
    Assert.assertNotNull(object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG)));
    JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG));
    for (Object mesg : mesgs) {
        Assert.assertEquals(mesg.toString().trim(),
                reportsAPIConfig.get(HttpsReportsAPIConfig.USAGE_END_DATE_ERROR));
    }
}