File tree Expand file tree Collapse file tree 3 files changed +9
-9
lines changed
main/java/com/thealgorithms/others/cn
test/java/com/thealgorithms/others/cn Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 2
2
3
3
public final class HammingDistance {
4
4
5
- private HammingDistance () {
6
- }
5
+ private HammingDistance () {
6
+ }
7
7
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 ());
11
11
12
- return (int ) chain .handle (bitsStrA , bitsStrB );
13
- }
12
+ return (int ) chain .handle (bitsStrA , bitsStrB );
13
+ }
14
14
}
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ public class ValidateBinaryHandlerTest {
9
9
10
10
@ Test
11
11
public void validBinaryStringsShouldPass () {
12
- handler .setNext (new MockHammingHandler ("PASSED" ));
12
+ handler .setNext (new MockHammingHandler ("PASSED" ));
13
13
Object result = handler .handle ("1010" , "0110" );
14
14
Assertions .assertThat (result ).isEqualTo ("PASSED" );
15
15
}
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ public class ValidateLengthHandlerTest {
9
9
10
10
@ Test
11
11
public void validLengthShouldPass () {
12
- handler .setNext (new MockHammingHandler ("LENGTH_OK" ));
12
+ handler .setNext (new MockHammingHandler ("LENGTH_OK" ));
13
13
Object result = handler .handle ("1010" , "0110" );
14
14
Assertions .assertThat (result ).isEqualTo ("LENGTH_OK" );
15
15
}
You can’t perform that action at this time.
0 commit comments