use of com.google.refine.model.Cell in project OpenRefine by OpenRefine.
the class HtmlExporterTests method CreateGrid.
protected void CreateGrid(int noOfRows, int noOfColumns) {
CreateColumns(noOfColumns);
for (int i = 0; i < noOfRows; i++) {
Row row = new Row(noOfColumns);
for (int j = 0; j < noOfColumns; j++) {
row.cells.add(new Cell("row" + i + "cell" + j, null));
}
project.rows.add(row);
}
}
use of com.google.refine.model.Cell in project OpenRefine by OpenRefine.
the class TsvExporterTests method exportTsvWithQuote.
@Test
public void exportTsvWithQuote() {
CreateGrid(3, 3);
project.rows.get(1).cells.set(1, new Cell("line has \"quote\"", null));
try {
SUT.export(project, options, engine, writer);
} catch (IOException e) {
Assert.fail();
}
Assert.assertEquals(writer.toString(), "column0\tcolumn1\tcolumn2\n" + "row0cell0\trow0cell1\trow0cell2\n" + "row1cell0\t\"line has \"\"quote\"\"\"\trow1cell2\n" + "row2cell0\trow2cell1\trow2cell2\n");
}
use of com.google.refine.model.Cell in project OpenRefine by OpenRefine.
the class RowTests method saveRow.
@Test
public void saveRow() {
Row row = new Row(5);
row.setCell(0, new Cell("I'm not empty", null));
row.save(writer, options);
Assert.assertEquals(writer.getBuffer().toString(), "{\"flagged\":false,\"starred\":false,\"cells\":[{\"v\":\"I'm not empty\"}]}");
}
use of com.google.refine.model.Cell in project OpenRefine by OpenRefine.
the class RowTests method notEmptyRow.
@Test
public void notEmptyRow() {
Row row = new Row(1);
row.setCell(0, new Cell("I'm not empty", null));
Assert.assertFalse(row.isEmpty());
}
use of com.google.refine.model.Cell in project OpenRefine by OpenRefine.
the class RowTests method saveRowWithRecordIndex.
@Test
public void saveRowWithRecordIndex() {
Row row = new Row(5);
row.setCell(0, new Cell("I'm not empty", null));
when(options.containsKey("rowIndex")).thenReturn(true);
when(options.get("rowIndex")).thenReturn(0);
when(options.containsKey("recordIndex")).thenReturn(true);
when(options.get("recordIndex")).thenReturn(1);
row.save(writer, options);
Assert.assertEquals(writer.getBuffer().toString(), "{\"flagged\":false,\"starred\":false,\"cells\":[{\"v\":\"I'm not empty\"}],\"i\":0,\"j\":1}");
}
Aggregations