### Question:
MDSpecializer { Collection<MD> specialize(MD md) { MDSite lhs = md.getLhs(); MDElement rhs = md.getRhs(); return specializer.specialize(lhs, rhs, lhs::getOrDefault); }    }### Answer:
@Test public void test() { doReturn(OptionalDouble.of(0.8)).when(provider).getNext(0, 0.7); doReturn(OptionalDouble.empty()).when(provider).getNext(1, 1.0); doReturn(OptionalDouble.of(1.0)).when(provider).getNext(2, 0.0); doReturn(OptionalDouble.of(0.6)).when(provider).getNext(3, 0.0); doReturn(OptionalDouble.empty()).when(provider).getNext(4, 0.0); when(Boolean.valueOf(specializationFilter.filter(any(), any()))).thenReturn(Boolean.TRUE); int columnPairs = 5; MDSite lhs = new MDSiteImpl(columnPairs) .set(0, 0.7) .set(1, 1.0); MDElement rhs = new MDElementImpl(3, 0.8); Collection<MD> result = buildSpecializer() .specialize(new MDImpl(lhs, rhs)); assertThat(result).hasSize(3); assertThat(result).contains(new MDImpl(lhs.clone().set(0, 0.8), new MDElementImpl(3, 0.8))); assertThat(result).contains(new MDImpl(lhs.clone().set(2, 1.0), new MDElementImpl(3, 0.8))); assertThat(result).contains(new MDImpl(lhs.clone().set(3, 0.6), new MDElementImpl(3, 0.8))); }