VavrHammingEncoder implements HammingEncoder { @Override public EncodedString encode(BinaryString input) { String result = helper.getHammingCodewordIndices(input.getValue().length()) .map(i -> toHammingCodeValue(i, input)) .reduce(String::concat); return EncodedString.of(result); }  @Override EncodedString encode(BinaryString input);  }
@Test @DisplayName("should always encode zeros to zeros") void shouldEncodeZeros() { Stream.iterate("0", i -> i + "0") .take(1000) .map(it -> sut.encode(BinaryString.of(it)).getValue()) .forEach(msg -> assertThat(msg).doesNotContain("1")); }