/** Empty indicators array means no indicators. */ public void indicatorsEmpty() { ObjectNode node = builder.buildDataSetNode(dataSetId, name, description, owner, lastChange); node.put("indicators", new ObjectMapper().createArrayNode()); server.register(dataSetsUri + "/" + dataSetId, node.toString()); DataSet dataSet = service.loadDataSet(dataSetId); assertEquals(dataSet.getIndicators(), Collections.emptyList()); }
/** No indicators field means no indicators. */ public void indicatorsMissing() { server.register( dataSetsUri + "/" + dataSetId, builder.buildDataSetNode(dataSetId, name, description, owner, lastChange).toString()); DataSet dataSet = service.loadDataSet(dataSetId); assertEquals(dataSet.getIndicators(), Collections.emptyList()); }
/** Indicator groups are parsed correctly. */ public void groupIndicator() { ObjectNode node = builder.buildDataSetNode(dataSetId, name, description, owner, lastChange); node.put( "indicators", new ObjectMapper() .createArrayNode() .add(builder.buildIndicatorNode(id, name, code, formula, "indicator_group"))); server.register(dataSetsUri + "/" + dataSetId, node.toString()); DataSet dataSet = service.loadDataSet(dataSetId); assertEquals(dataSet.getIndicators().size(), 1); Indicator indicator = dataSet.getIndicators().get(0); assertEquals(indicator.getId(), id); assertEquals(indicator.getName(), name); assertEquals(indicator.getCode(), null); assertEquals(indicator.getFormula(), null); assertEquals(indicator.getType(), IndicatorType.GROUP); }