本文整理汇总了Java中com.mockrunner.mock.jdbc.MockResultSet.next方法的典型用法代码示例。如果您正苦于以下问题:Java MockResultSet.next方法的具体用法?Java MockResultSet.next怎么用?Java MockResultSet.next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mockrunner.mock.jdbc.MockResultSet
的用法示例。
在下文中一共展示了MockResultSet.next方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEmpty
import com.mockrunner.mock.jdbc.MockResultSet; //导入方法依赖的package包/类
@Test
public void testEmpty() throws Exception {
MockResultSet resultSet = new MockResultSet("data");
StringWriter stringWriter = new StringWriter();
JsonWriter jsonWriter = new JsonWriter(stringWriter);
jsonWriter.beginObject();
MetricDataService.MetricDataRowCallbackHandler handler = new MetricDataService.MetricDataRowCallbackHandler(
jsonWriter, 0, 3, 1
);
while (resultSet.next()) {
handler.processRow(resultSet);
}
handler.finish();
jsonWriter.endObject();
Assert.assertEquals("{}", stringWriter.toString());
}
示例2: testHandler
import com.mockrunner.mock.jdbc.MockResultSet; //导入方法依赖的package包/类
@Test
public void testHandler() throws Exception {
MockResultSet resultSet = new MockResultSet("data");
resultSet.addColumn("metric", new String[]{"name1", "name1", "name2", "name2"});
resultSet.addColumn("ts", new Integer[]{100, 160, 160, 220});
resultSet.addColumn("value", new Double[]{33.33, 42.0, 32.0, 77.7});
StringWriter stringWriter = new StringWriter();
JsonWriter jsonWriter = new JsonWriter(stringWriter);
jsonWriter.beginObject();
MetricDataService.MetricDataRowCallbackHandler handler = new MetricDataService.MetricDataRowCallbackHandler(
jsonWriter, 100, 280, 60
);
while (resultSet.next()) {
handler.processRow(resultSet);
}
handler.finish();
jsonWriter.endObject();
JsonObject expected = new JsonObject();
expected.add("name1", createMetric(100, 280, 60, 33.33, 42.0, Double.NaN));
expected.add("name2", createMetric(100, 280, 60, Double.NaN, 32.0, 77.7));
Assert.assertEquals(expected.toString(), stringWriter.toString());
}
示例3: testChNan
import com.mockrunner.mock.jdbc.MockResultSet; //导入方法依赖的package包/类
@Test
public void testChNan() throws Exception {
MockResultSet resultSet = new MockResultSet("data");
resultSet.addColumn("metric", new String[]{"name1", "name1", "name1"});
resultSet.addColumn("ts", new Integer[]{0, 1, 2});
resultSet.addColumn("value", new Double[]{0.0, Double.NaN, 2.0});
StringWriter stringWriter = new StringWriter();
JsonWriter jsonWriter = new JsonWriter(stringWriter);
jsonWriter.beginObject();
MetricDataService.MetricDataRowCallbackHandler handler = new MetricDataService.MetricDataRowCallbackHandler(
jsonWriter, 0, 3, 1
);
while (resultSet.next()) {
handler.processRow(resultSet);
}
handler.finish();
jsonWriter.endObject();
JsonObject expected = new JsonObject();
expected.add("name1", createMetric(0, 3, 1, 0.0, Double.NaN, 2.0));
Assert.assertEquals(expected.toString(), stringWriter.toString());
}