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


Java DataTable.create方法代码示例

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


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

示例1: modifyDataInvalidModificationTypeStringTest

import cucumber.api.DataTable; //导入方法依赖的package包/类
@Test
public void modifyDataInvalidModificationTypeStringTest() throws Exception {
    ThreadProperty.set("class", this.getClass().getCanonicalName());
    CommonG commong = new CommonG();
    String data = "username=username&password=password";
    String type = "string";
    List<List<String>> rawData = Arrays.asList(Arrays.asList("username=username", "REMOVE", "N/A"));
    DataTable modifications = DataTable.create(rawData);

    try {
        commong.modifyData(data, type, modifications);
        fail("Expected Exception");
    } catch (Exception e) {
        assertThat(e.getClass().toString()).as("Unexpected exception").isEqualTo(Exception.class.toString());
        assertThat(e.getMessage()).as("Unexpected exception message").isEqualTo("Modification type does not exist: REMOVE");
    }
}
 
开发者ID:Stratio,项目名称:bdt,代码行数:18,代码来源:CommonGTest.java

示例2: testNotParsedArraySizeInJSON

import cucumber.api.DataTable; //导入方法依赖的package包/类
@Test(expectedExceptions = AssertionError.class)
public void testNotParsedArraySizeInJSON() throws Exception {
    String baseData = "consulMesosJSON.conf";
    String envVar = "exampleEnvVar";
    ThreadProperty.set("class", this.getClass().getCanonicalName());
    CommonG commong = new CommonG();
    ThenGSpec theng = new ThenGSpec(commong);

    String result = new String(Files.readAllBytes(
            Paths.get(getClass().getClassLoader().getResource(baseData).getFile())));

    ThreadProperty.set(envVar, result);

    List<String> row1 = Arrays.asList("$.[0]", "size", "4");
    List<List<String>> rawData = Arrays.asList(row1);

    DataTable table = DataTable.create(rawData);
    theng.matchWithExpresion(envVar, table);
}
 
开发者ID:Stratio,项目名称:bdt,代码行数:20,代码来源:ThenGTest.java

示例3: modifyDataAddToJsonStringTest_2

import cucumber.api.DataTable; //导入方法依赖的package包/类
@Test
public void modifyDataAddToJsonStringTest_2() throws Exception {
    ThreadProperty.set("class", this.getClass().getCanonicalName());
    CommonG commong = new CommonG();

    JSONObject jsonObject = new JSONObject();
    jsonObject.put("key1", new JSONArray(Arrays.asList("value1")));
    String data = jsonObject.toString();
    String expectedData = "{\"key1\":[\"value1\",\"\"]}";
    String type = "json";
    List<List<String>> rawData = Arrays.asList(Arrays.asList("key1", "ADDTO", "", "string"));
    DataTable modifications = DataTable.create(rawData);

    String modifiedData = commong.modifyData(data, type, modifications);
    JSONAssert.assertEquals(expectedData, modifiedData, false);
}
 
开发者ID:Stratio,项目名称:bdt,代码行数:17,代码来源:CommonGTest.java

示例4: modifyDataAddToJsonNullTest_2

import cucumber.api.DataTable; //导入方法依赖的package包/类
@Test
public void modifyDataAddToJsonNullTest_2() throws Exception {
    ThreadProperty.set("class", this.getClass().getCanonicalName());
    CommonG commong = new CommonG();

    JSONObject jsonObject = new JSONObject();
    jsonObject.put("key1", new JSONArray(Arrays.asList("value1")));
    String data = jsonObject.toString();
    String expectedData = "{\"key1\":[\"value1\",null]}";
    String type = "json";
    List<List<String>> rawData = Arrays.asList(Arrays.asList("key1", "ADDTO", "", "null"));
    DataTable modifications = DataTable.create(rawData);

    String modifiedData = commong.modifyData(data, type, modifications);
    JSONAssert.assertEquals(expectedData, modifiedData, false);
}
 
开发者ID:Stratio,项目名称:bdt,代码行数:17,代码来源:CommonGTest.java

示例5: testReadFileToVariableJSON

import cucumber.api.DataTable; //导入方法依赖的package包/类
@Test
public void testReadFileToVariableJSON() throws Exception {
    ThreadProperty.set("class", this.getClass().getCanonicalName());

    String baseData = "schemas/testCreateFile.json";
    String type = "json";
    String envVar = "myjson";
    List<List<String>> rawData = Arrays.asList(Arrays.asList("key1", "UPDATE", "new_value", "n/a"), Arrays.asList("key2", "ADDTO", "[\"new_value\"]", "array"));
    DataTable modifications = DataTable.create(rawData);

    CommonG commong = new CommonG();
    WhenGSpec wheng = new WhenGSpec(commong);

    wheng.readFileToVariable(baseData, type, envVar, modifications);

    String envVarResult = ThreadProperty.get(envVar);
    String expectedResult = "{\"key1\":\"new_value\",\"key2\":[[\"new_value\"]],\"key3\":{\"key3_2\":\"value3_2\",\"key3_1\":\"value3_1\"}}";

    assertThat(envVarResult).as("Not as expected").isEqualTo(expectedResult);
}
 
开发者ID:Stratio,项目名称:bdt,代码行数:21,代码来源:WhenGTest.java

示例6: testKeysContainsInJSON

import cucumber.api.DataTable; //导入方法依赖的package包/类
@Test
public void testKeysContainsInJSON() throws Exception {
    String baseData = "exampleJSON.conf";
    String envVar = "exampleEnvVar";
    ThreadProperty.set("class", this.getClass().getCanonicalName());
    CommonG commong = new CommonG();
    ThenGSpec theng = new ThenGSpec(commong);

    String result = new String(Files.readAllBytes(
            Paths.get(getClass().getClassLoader().getResource(baseData).getFile())));

    ThreadProperty.set(envVar, result);

    List<String> row1 = Arrays.asList("$.glossary.~[0]", "contains", "title");
    List<String> row2 = Arrays.asList("$.glossary.GlossDiv.~", "contains", "GlossList");

    List<List<String>> rawData = Arrays.asList(row1, row2);

    DataTable table = DataTable.create(rawData);

    theng.matchWithExpresion(envVar, table);

}
 
开发者ID:Stratio,项目名称:bdt,代码行数:24,代码来源:ThenGTest.java

示例7: testValueNotEqualInJSON

import cucumber.api.DataTable; //导入方法依赖的package包/类
@Test
public void testValueNotEqualInJSON() throws Exception {
    String baseData = "consulMesosJSON.conf";
    String envVar = "consulMesos";
    ThreadProperty.set("class", this.getClass().getCanonicalName());
    CommonG commong = new CommonG();
    ThenGSpec theng = new ThenGSpec(commong);

    String result = new String(Files.readAllBytes(
            Paths.get(getClass().getClassLoader().getResource(baseData).getFile())));

    ThreadProperty.set(envVar, result);

    List<String> row1 = Arrays.asList("$.[1].Node", "not equal", "paaslab31.stratio.com");
    List<String> row2 = Arrays.asList("[2].Node", "not equal", "paaslab32.stratio.com");

    List<List<String>> rawData = Arrays.asList(row1, row2);

    DataTable table = DataTable.create(rawData);

    theng.matchWithExpresion(envVar, table);

}
 
开发者ID:Stratio,项目名称:bdt,代码行数:24,代码来源:ThenGTest.java

示例8: modifyDataAddToJsonArrayTest_3

import cucumber.api.DataTable; //导入方法依赖的package包/类
@Test
public void modifyDataAddToJsonArrayTest_3() throws Exception {
    ThreadProperty.set("class", this.getClass().getCanonicalName());
    CommonG commong = new CommonG();

    JSONObject jsonObject = new JSONObject();
    jsonObject.put("key1", new JSONArray(Arrays.asList("value1")));
    String data = jsonObject.toString();
    String expectedData = "{\"key1\":[\"value1\",[[]]]}";
    String type = "json";
    List<List<String>> rawData = Arrays.asList(Arrays.asList("key1", "ADDTO", "[[]]", "array"));
    DataTable modifications = DataTable.create(rawData);

    String modifiedData = commong.modifyData(data, type, modifications);
    JSONAssert.assertEquals(expectedData, modifiedData, false);
}
 
开发者ID:Stratio,项目名称:bdt,代码行数:17,代码来源:CommonGTest.java

示例9: modifyDataAddToJsonArrayTest_2

import cucumber.api.DataTable; //导入方法依赖的package包/类
@Test
public void modifyDataAddToJsonArrayTest_2() throws Exception {
    ThreadProperty.set("class", this.getClass().getCanonicalName());
    CommonG commong = new CommonG();

    JSONObject jsonObject = new JSONObject();
    jsonObject.put("key1", new JSONArray(Arrays.asList("value1")));
    String data = jsonObject.toString();
    String expectedData = "{\"key1\":[\"value1\",[]]}";
    String type = "json";
    List<List<String>> rawData = Arrays.asList(Arrays.asList("key1", "ADDTO", "[]", "array"));
    DataTable modifications = DataTable.create(rawData);

    String modifiedData = commong.modifyData(data, type, modifications);
    JSONAssert.assertEquals(expectedData, modifiedData, false);
}
 
开发者ID:Stratio,项目名称:bdt,代码行数:17,代码来源:CommonGTest.java

示例10: testValueEqualInJSON

import cucumber.api.DataTable; //导入方法依赖的package包/类
@Test
public void testValueEqualInJSON() throws Exception {
    String baseData = "consulMesosJSON.conf";
    String envVar = "consulMesos";
    ThreadProperty.set("class", this.getClass().getCanonicalName());
    CommonG commong = new CommonG();
    ThenGSpec theng = new ThenGSpec(commong);

    String result = new String(Files.readAllBytes(
            Paths.get(getClass().getClassLoader().getResource(baseData).getFile())));

    ThreadProperty.set(envVar, result);

    List<String> row1 = Arrays.asList("$.[0].Node", "equal", "paaslab31.stratio.com");
    List<String> row2 = Arrays.asList("[0].Node", "equal", "paaslab31.stratio.com");

    List<List<String>> rawData = Arrays.asList(row1, row2);

    DataTable table = DataTable.create(rawData);

    theng.matchWithExpresion(envVar, table);

}
 
开发者ID:Stratio,项目名称:bdt,代码行数:24,代码来源:ThenGTest.java

示例11: modifyDataAddToJsonObjectTest_2

import cucumber.api.DataTable; //导入方法依赖的package包/类
@Test
public void modifyDataAddToJsonObjectTest_2() throws Exception {
    ThreadProperty.set("class", this.getClass().getCanonicalName());
    CommonG commong = new CommonG();

    JSONObject jsonObject = new JSONObject();
    jsonObject.put("key1", new JSONArray(Arrays.asList("value1")));
    String data = jsonObject.toString();
    String expectedData = "{\"key1\":[\"value1\",{}]}";
    String type = "json";
    List<List<String>> rawData = Arrays.asList(Arrays.asList("key1", "ADDTO", "{}", "object"));
    DataTable modifications = DataTable.create(rawData);

    String modifiedData = commong.modifyData(data, type, modifications);
    JSONAssert.assertEquals(expectedData, modifiedData, false);
}
 
开发者ID:Stratio,项目名称:bdt,代码行数:17,代码来源:CommonGTest.java

示例12: modifyDataAddToJsonNumberTest_2

import cucumber.api.DataTable; //导入方法依赖的package包/类
@Test
public void modifyDataAddToJsonNumberTest_2() throws Exception {
    ThreadProperty.set("class", this.getClass().getCanonicalName());
    CommonG commong = new CommonG();

    JSONObject jsonObject = new JSONObject();
    jsonObject.put("key1", new JSONArray(Arrays.asList("value1")));
    String data = jsonObject.toString();
    String expectedData = "{\"key1\":[\"value1\",66.6]}";
    String type = "json";
    List<List<String>> rawData = Arrays.asList(Arrays.asList("key1", "ADDTO", "66.6", "number"));
    DataTable modifications = DataTable.create(rawData);

    String modifiedData = commong.modifyData(data, type, modifications);
    JSONAssert.assertEquals(expectedData, modifiedData, false);
}
 
开发者ID:Stratio,项目名称:bdt,代码行数:17,代码来源:CommonGTest.java

示例13: modifyDataNullValueJsonTest

import cucumber.api.DataTable; //导入方法依赖的package包/类
@Test
public void modifyDataNullValueJsonTest() throws Exception {
    ThreadProperty.set("class", this.getClass().getCanonicalName());
    CommonG commong = new CommonG();
    String data = jsonObject4.toString();
    String expectedData = "{\"key2\":{\"key3\":null}}";
    String type = "json";
    List<List<String>> rawData = Arrays.asList(Arrays.asList("key1", "DELETE", "N/A"));
    DataTable modifications = DataTable.create(rawData);

    String modifiedData = commong.modifyData(data, type, modifications);
    JSONAssert.assertEquals(expectedData, modifiedData, false);
}
 
开发者ID:Stratio,项目名称:bdt,代码行数:14,代码来源:CommonGTest.java

示例14: modifyDataAddStringTest

import cucumber.api.DataTable; //导入方法依赖的package包/类
@Test
public void modifyDataAddStringTest() throws Exception {
    ThreadProperty.set("class", this.getClass().getCanonicalName());
    CommonG commong = new CommonG();
    String data = "username=username&password=password";
    String expectedData = "username=username&password=password&config=config";
    String type = "string";
    List<List<String>> rawData = Arrays.asList(Arrays.asList("N/A", "ADD", "&config=config"));
    DataTable modifications = DataTable.create(rawData);

    String modifiedData = commong.modifyData(data, type, modifications);
    assertThat(modifiedData).as("Unexpected modified data").isEqualTo(expectedData);
}
 
开发者ID:Stratio,项目名称:bdt,代码行数:14,代码来源:CommonGTest.java

示例15: modifyDataUpdateStringTest

import cucumber.api.DataTable; //导入方法依赖的package包/类
@Test
public void modifyDataUpdateStringTest() throws Exception {
    ThreadProperty.set("class", this.getClass().getCanonicalName());
    CommonG commong = new CommonG();
    String data = "username=username&password=password";
    String expectedData = "username=NEWusername&password=password";
    String type = "string";
    List<List<String>> rawData = Arrays.asList(Arrays.asList("username=username", "UPDATE", "username=NEWusername"));
    DataTable modifications = DataTable.create(rawData);

    String modifiedData = commong.modifyData(data, type, modifications);
    assertThat(modifiedData).as("Unexpected modified data").isEqualTo(expectedData);
}
 
开发者ID:Stratio,项目名称:bdt,代码行数:14,代码来源:CommonGTest.java


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