File tree Expand file tree Collapse file tree
main/java/com/thealgorithms/others/cn
test/java/com/thealgorithms/others/cn Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33public final class HammingDistance {
44
5- private HammingDistance () {
6- }
5+ private HammingDistance () {
6+ }
77
8- public static int compute (String bitsStrA , String bitsStrB ) {
9- HammingHandler chain = new ValidateBinaryHandler ();
10- chain .setNext (new ValidateLengthHandler ()).setNext (new ComputeHammingHandler ());
8+ public static int compute (String bitsStrA , String bitsStrB ) {
9+ HammingHandler chain = new ValidateBinaryHandler ();
10+ chain .setNext (new ValidateLengthHandler ()).setNext (new ComputeHammingHandler ());
1111
12- return (int ) chain .handle (bitsStrA , bitsStrB );
13- }
12+ return (int ) chain .handle (bitsStrA , bitsStrB );
13+ }
1414}
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ public class ValidateBinaryHandlerTest {
99
1010 @ Test
1111 public void validBinaryStringsShouldPass () {
12- handler .setNext (new MockHammingHandler ("PASSED" ));
12+ handler .setNext (new MockHammingHandler ("PASSED" ));
1313 Object result = handler .handle ("1010" , "0110" );
1414 Assertions .assertThat (result ).isEqualTo ("PASSED" );
1515 }
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ public class ValidateLengthHandlerTest {
99
1010 @ Test
1111 public void validLengthShouldPass () {
12- handler .setNext (new MockHammingHandler ("LENGTH_OK" ));
12+ handler .setNext (new MockHammingHandler ("LENGTH_OK" ));
1313 Object result = handler .handle ("1010" , "0110" );
1414 Assertions .assertThat (result ).isEqualTo ("LENGTH_OK" );
1515 }
You can’t perform that action at this time.
0 commit comments