@Test
public void testFit() {

    Map<Integer, Vector> data = new HashMap<>();
    data.put(1, VectorUtils.of(2, 4, 1));
    data.put(2, VectorUtils.of(1, 8, 22));
    data.put(3, VectorUtils.of(4, 10, 100));
    data.put(4, VectorUtils.of(0, 22, 300));
    final Vectorizer<Integer, Vector, Integer, Double> vectorizer = new DummyVectorizer<>(0, 1, 2);
    DatasetBuilder<Integer, Vector> datasetBuilder = new LocalDatasetBuilder<>(data, parts);
    BinarizationTrainer<Integer, Vector> binarizationTrainer = new BinarizationTrainer<Integer, Vector>()
        .withThreshold(10);
    assertEquals(10., binarizationTrainer.getThreshold(), 0);
    BinarizationPreprocessor<Integer, Vector> preprocessor = binarizationTrainer.fit(
        TestUtils.testEnvBuilder(),
        datasetBuilder,
        vectorizer
    );
    assertEquals(binarizationTrainer.getThreshold(), preprocessor.getThreshold(), 0);
    assertArrayEquals(new double[] {0, 0, 1}, preprocessor.apply(5, VectorUtils.of(1, 10, 100)).features().asArray(), 1e-8);
}