Search in sources :

Example 1 with RangeFacetConfig

use of com.google.refine.browsing.facets.RangeFacet.RangeFacetConfig in project OpenRefine by OpenRefine.

the class RangeFacetTests method serializeRangeFacet.

@Test
public void serializeRangeFacet() throws JsonParseException, JsonMappingException, IOException {
    Project project = createCSVProject("my column\n" + "89.2\n" + "-45.9\n" + "blah\n" + "0.4\n");
    project.rows.get(0).cells.set(0, new Cell(89.2, null));
    project.rows.get(1).cells.set(0, new Cell(-45.9, null));
    project.rows.get(3).cells.set(0, new Cell(0.4, null));
    Engine engine = new Engine(project);
    RangeFacetConfig config = ParsingUtilities.mapper.readValue(configJson, RangeFacetConfig.class);
    RangeFacet facet = config.apply(project);
    facet.computeChoices(project, engine.getAllFilteredRows());
    TestUtils.isSerializedTo(facet, facetJson);
}
Also used : Project(com.google.refine.model.Project) RangeFacet(com.google.refine.browsing.facets.RangeFacet) RangeFacetConfig(com.google.refine.browsing.facets.RangeFacet.RangeFacetConfig) Cell(com.google.refine.model.Cell) Engine(com.google.refine.browsing.Engine) RefineTest(com.google.refine.RefineTest) Test(org.testng.annotations.Test)

Example 2 with RangeFacetConfig

use of com.google.refine.browsing.facets.RangeFacet.RangeFacetConfig in project OpenRefine by OpenRefine.

the class RangeFacetTests method serializeRangeFacetConfig.

@Test
public void serializeRangeFacetConfig() throws JsonParseException, JsonMappingException, IOException {
    RangeFacetConfig config = ParsingUtilities.mapper.readValue(configJson, RangeFacetConfig.class);
    TestUtils.isSerializedTo(config, configJson);
}
Also used : RangeFacetConfig(com.google.refine.browsing.facets.RangeFacet.RangeFacetConfig) RefineTest(com.google.refine.RefineTest) Test(org.testng.annotations.Test)

Aggregations

RefineTest (com.google.refine.RefineTest)2 RangeFacetConfig (com.google.refine.browsing.facets.RangeFacet.RangeFacetConfig)2 Test (org.testng.annotations.Test)2 Engine (com.google.refine.browsing.Engine)1 RangeFacet (com.google.refine.browsing.facets.RangeFacet)1 Cell (com.google.refine.model.Cell)1 Project (com.google.refine.model.Project)1