当前位置: 首页>>代码示例>>Java>>正文


Java JSONObject.clear方法代码示例

本文整理汇总了Java中net.sf.json.JSONObject.clear方法的典型用法代码示例。如果您正苦于以下问题:Java JSONObject.clear方法的具体用法?Java JSONObject.clear怎么用?Java JSONObject.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sf.json.JSONObject的用法示例。


在下文中一共展示了JSONObject.clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testFlow

import net.sf.json.JSONObject; //导入方法依赖的package包/类
@org.junit.Test
public void testFlow() throws Exception {
    StatusNotifierCallbackTest.StatusNotifierCallbackImpl notifier = new StatusNotifierCallbackTest.StatusNotifierCallbackImpl();
    BlazeMeterHttpUtilsEmul emul = new BlazeMeterHttpUtilsEmul(notifier, "test_address", "test_data_address", new BlazeMeterReport());

    JSONObject result = new JSONObject();
    result.put("id", "100");
    result.put("name", "NEW_TEST");
    JSONObject response = new JSONObject();
    response.put("result", result);

    Project project = new Project(emul, "10", "projectName");
    emul.addEmul(response);
    Test test = project.createTest("NEW_WORKSPACE");
    assertEquals("100", test.getId());
    assertEquals("NEW_TEST", test.getName());

    response.clear();
    JSONArray results = new JSONArray();
    results.add(result);
    results.add(result);
    response.put("result", results);
    emul.addEmul(response);

    List<Test> tests = project.getTests();
    assertEquals(2, tests.size());
    for (Test t :tests) {
        assertEquals("100", t.getId());
        assertEquals("NEW_TEST", t.getName());
    }
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:32,代码来源:ProjectTest.java

示例2: testFlow

import net.sf.json.JSONObject; //导入方法依赖的package包/类
@org.junit.Test
public void testFlow() throws Exception {
    StatusNotifierCallbackTest.StatusNotifierCallbackImpl notifier = new StatusNotifierCallbackTest.StatusNotifierCallbackImpl();
    BlazeMeterHttpUtilsEmul emul = new BlazeMeterHttpUtilsEmul(notifier, "test_address", "test_data_address", new BlazeMeterReport());

    JSONObject result = new JSONObject();
    result.put("id", "999");
    result.put("name", "NEW_PROJECT");
    JSONObject response = new JSONObject();
    response.put("result", result);

    Workspace workspace = new Workspace(emul, "888", "workspace_name");
    emul.addEmul(response);
    Project project = workspace.createProject("NEW_PROJECT");
    assertEquals("999", project.getId());
    assertEquals("NEW_PROJECT", project.getName());

    response.clear();
    JSONArray results = new JSONArray();
    results.add(result);
    results.add(result);
    response.put("result", results);
    emul.addEmul(response);

    List<Project> projects = workspace.getProjects();
    assertEquals(2, projects.size());
    for (Project p :projects) {
        assertEquals("999", p.getId());
        assertEquals("NEW_PROJECT", p.getName());
    }
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:32,代码来源:WorkspaceTest.java

示例3: testFlow

import net.sf.json.JSONObject; //导入方法依赖的package包/类
@Test
public void testFlow() throws Exception {
    StatusNotifierCallbackTest.StatusNotifierCallbackImpl notifier = new StatusNotifierCallbackTest.StatusNotifierCallbackImpl();
    BlazeMeterHttpUtilsEmul emul = new BlazeMeterHttpUtilsEmul(notifier, "test_address", "test_data_address", new BlazeMeterReport());

    JSONObject result = new JSONObject();
    result.put("id", "100");
    result.put("name", "NEW_WORKSPACE");
    JSONObject response = new JSONObject();
    response.put("result", result);

    Account account = new Account(emul, "777", "account_name");
    emul.addEmul(response);
    Workspace workspace = account.createWorkspace("NEW_WORKSPACE");
    assertEquals("100", workspace.getId());
    assertEquals("NEW_WORKSPACE", workspace.getName());

    response.clear();
    JSONArray results = new JSONArray();
    results.add(result);
    results.add(result);
    response.put("result", results);
    emul.addEmul(response);

    List<Workspace> workspaces = account.getWorkspaces();
    assertEquals(2, workspaces.size());
    for (Workspace wsp :workspaces) {
        assertEquals("100", wsp.getId());
        assertEquals("NEW_WORKSPACE", wsp.getName());
    }
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:32,代码来源:AccountTest.java


注:本文中的net.sf.json.JSONObject.clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。