public void testTruncate() {
long[] keys = {1, 2, 3, 4};
double[] values = {1.0, 2.0, 3.0, 4.0};
MutableSparseVector v = MutableSparseVector.wrap(keys, values);
VectorTruncator truncator = new ThresholdTruncator(new RealThreshold(3.5));
truncator.truncate(v);
int numSeen = 0;
for (VectorEntry e : v.view(VectorEntry.State.SET)) {
assertThat(e.getKey(), equalTo(4L));