Search in sources :

Example 1 with LargestTriangleThreeBucketsGeneralizer

use of org.n52.io.type.quantity.generalize.LargestTriangleThreeBucketsGeneralizer in project series-rest-api by 52North.

the class LargestTriangleThreeBucketsGeneralizerTest method when_quotientHasNonterminatingDecimals_then_noArithmeticExceptionIsThrown.

@Test
public void when_quotientHasNonterminatingDecimals_then_noArithmeticExceptionIsThrown() throws GeneralizerException {
    // https://github.com/52North/series-rest-api/issues/446
    TvpDataCollection<Data<QuantityValue>> collection = new TvpDataCollection<>();
    collection.addNewSeries("test", getData(10000));
    long threshold = 100L;
    IoParameters defaults = IoParameters.createDefaults().extendWith("threshold", Long.toString(threshold));
    Generalizer<Data<QuantityValue>> generalizer = new LargestTriangleThreeBucketsGeneralizer(defaults);
    DataCollection<Data<QuantityValue>> generalizedData = generalizer.generalize(collection);
    assertThat(generalizedData.getSeries("test").size(), Is.is(threshold));
}
Also used : TvpDataCollection(org.n52.io.TvpDataCollection) LargestTriangleThreeBucketsGeneralizer(org.n52.io.type.quantity.generalize.LargestTriangleThreeBucketsGeneralizer) Data(org.n52.io.response.dataset.Data) IoParameters(org.n52.io.request.IoParameters) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 TvpDataCollection (org.n52.io.TvpDataCollection)1 IoParameters (org.n52.io.request.IoParameters)1 Data (org.n52.io.response.dataset.Data)1 LargestTriangleThreeBucketsGeneralizer (org.n52.io.type.quantity.generalize.LargestTriangleThreeBucketsGeneralizer)1