@Test
public void testAdd() {

    Random rnd = new Random(0);
    GiniImpurityMeasure a = new GiniImpurityMeasure(
        new long[]{randCnt(rnd), randCnt(rnd), randCnt(rnd)},
        new long[]{randCnt(rnd), randCnt(rnd), randCnt(rnd)}
    );
    GiniImpurityMeasure b = new GiniImpurityMeasure(
        new long[]{randCnt(rnd), randCnt(rnd), randCnt(rnd)},
        new long[]{randCnt(rnd), randCnt(rnd), randCnt(rnd)}
    );
    GiniImpurityMeasure c = a.add(b);
    assertEquals(a.getLeft()[0] + b.getLeft()[0], c.getLeft()[0]);
    assertEquals(a.getLeft()[1] + b.getLeft()[1], c.getLeft()[1]);
    assertEquals(a.getLeft()[2] + b.getLeft()[2], c.getLeft()[2]);
    assertEquals(a.getRight()[0] + b.getRight()[0], c.getRight()[0]);
    assertEquals(a.getRight()[1] + b.getRight()[1], c.getRight()[1]);
    assertEquals(a.getRight()[2] + b.getRight()[2], c.getRight()[2]);
}