@Test
public void predResultLabelMapTest() {

    HashSet <Object> set = new HashSet <>();
    set.add("1.0");
    set.add("0.0");
    Tuple2<Map<Object, Integer>, Object[]> tuple2 = ClassificationEvaluationUtil.buildLabelIndexLabelArray(set, true, null, Types.DOUBLE);
    Map<Object, Integer> map = tuple2.f0;
    Assert.assertEquals(map.size(), 2);
    Assert.assertEquals((int) map.get("0.0"), 1);
    Assert.assertEquals((int) map.get("1.0"), 0);
    tuple2 = ClassificationEvaluationUtil.buildLabelIndexLabelArray(set, true, "0", Types.DOUBLE);
    map = tuple2.f0;
    Assert.assertEquals(map.size(), 2);
    Assert.assertEquals((int) map.get("0.0"), 0);
    Assert.assertEquals((int) map.get("1.0"), 1);
    set.add("2.0");
    tuple2 = ClassificationEvaluationUtil.buildLabelIndexLabelArray(set, false, null, Types.DOUBLE);
    map = tuple2.f0;
    Assert.assertEquals(map.size(), 3);
    Assert.assertEquals((int) map.get("0.0"), 2);
    Assert.assertEquals((int) map.get("1.0"), 1);
    Assert.assertEquals((int) map.get("2.0"), 0);
    Assert.assertArrayEquals(new String[]{"2.0", "1.0", "0.0"}, tuple2.f1);
}