### Question:
MDSpecializer { Collection<MD> specialize(MDSite lhs, MDElement rhs, SimilaritySet similaritySet) { return specializer.specialize(lhs, rhs, similaritySet::get); }    }### Answer:
@Test public void test() { MDSpecializer specializer = buildSpecializer(); int columnPairs = 4; MDSite lhs = new MDSiteImpl(columnPairs).set(1, 0.7); SimilaritySet similaritySet = new SimilaritySet(new double[]{0.7, 0.8, 0.6, 0.5}); doReturn(Optional.of(new MDSiteImpl(columnPairs).set(0, 0.8))).when(lhsSpecializer) .specialize(lhs, 0, similaritySet.get(0)); doReturn(Optional.empty()).when(lhsSpecializer) .specialize(lhs, 1, similaritySet.get(1)); doReturn(Optional.of(new MDSiteImpl(columnPairs).set(2, 0.7))).when(lhsSpecializer) .specialize(lhs, 2, similaritySet.get(2)); doReturn(Optional.of(new MDSiteImpl(columnPairs).set(3, 0.9))).when(lhsSpecializer) .specialize(lhs, 3, similaritySet.get(3)); when(Boolean.valueOf(specializationFilter.filter(any(), any()))).thenReturn(Boolean.TRUE); int rhsAttr = 3; MDElement rhs = new MDElementImpl(rhsAttr, 0.8); Collection<MD> specialized = specializer.specialize(lhs, rhs, similaritySet); assertThat(specialized).hasSize(3); assertThat(specialized).contains(new MDImpl(new MDSiteImpl(columnPairs).set(0, 0.8), new MDElementImpl(rhsAttr, 0.8))); assertThat(specialized).contains(new MDImpl(new MDSiteImpl(columnPairs).set(2, 0.7), new MDElementImpl(rhsAttr, 0.8))); assertThat(specialized).contains(new MDImpl(new MDSiteImpl(columnPairs).set(3, 0.9), new MDElementImpl(rhsAttr, 0.8))); }