Skip to content

Commit

Permalink
Improve WrappedBloomFilterTest
Browse files Browse the repository at this point in the history
All tests now assert copy() the same way
  • Loading branch information
garydgregory committed Oct 5, 2024
1 parent caa771a commit 6d86b4b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
1 change: 1 addition & 0 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<action type="fix" dev="ggregory" due-to="Dávid Szigecsán. Gary Gregory">Increase test coverage for ListUtils #517.</action>
<action type="fix" dev="ggregory" due-to="Dávid Szigecsán">Use the Junit (Jupiter) API #518.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory, Alex Herbert">BloomFilterExtractor.flatten() should throw an exception instead of returning null.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory, Claude Warren">Improve WrappedBloomFilterTest. All tests now assert copy() the same way.</action>
<!-- ADD -->
<action type="add" dev="ggregory" due-to="Gary Gregory">LayerManager.Builder implements Supplier.</action>
<action type="add" dev="ggregory" due-to="Gary Gregory, hemanth0525">Add CollectionUtils.duplicateList(Collection).</action>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,22 @@

public class WrappedBloomFilterTest extends AbstractBloomFilterTest<WrappedBloomFilter> {

private static class Fixture extends WrappedBloomFilter {

Fixture(final BloomFilter wrapped) {
super(wrapped);
}

@Override
public WrappedBloomFilter copy() {
return new Fixture(getWrapped().copy());
}

}

@Override
protected WrappedBloomFilter createEmptyFilter(final Shape shape) {
return new WrappedBloomFilter(new DefaultBloomFilterTest.SparseDefaultBloomFilter(shape)) {
@Override
public BloomFilter copy() {
final BloomFilter result = new DefaultBloomFilterTest.SparseDefaultBloomFilter(shape);
result.merge(getWrapped());
return result;
}
};
return new Fixture(new DefaultBloomFilterTest.SparseDefaultBloomFilter(shape));
}

@ParameterizedTest
Expand All @@ -45,20 +51,8 @@ public int characteristics() {
return characteristics;
}
};
final WrappedBloomFilter underTest = new WrappedBloomFilter(inner) {
@Override
public BloomFilter copy() {
final BloomFilter result = new DefaultBloomFilterTest.SparseDefaultBloomFilter(shape);
result.merge(getWrapped());
return result;
}
};
final WrappedBloomFilter underTest = new Fixture(inner);
assertEquals(characteristics, underTest.characteristics());
}

@Override
public void testCopy() {
testCopy(false);
}

}

0 comments on commit 6d86b4b

Please sign in to comment.