mirror of
https://github.com/TheAlgorithms/Java.git
synced 2026-03-13 08:40:43 +08:00
Add automatic linter (#4214)
This commit is contained in:
@@ -46,8 +46,7 @@ public class HammingDistanceTest {
|
||||
|
||||
@Test
|
||||
public void checkForLongDataBits() {
|
||||
String senderBits = "10010101101010000100110100",
|
||||
receiverBits = "00110100001011001100110101";
|
||||
String senderBits = "10010101101010000100110100", receiverBits = "00110100001011001100110101";
|
||||
int answer = hd.getHammingDistanceBetweenBits(senderBits, receiverBits);
|
||||
Assertions.assertThat(answer).isEqualTo(7);
|
||||
}
|
||||
@@ -56,16 +55,14 @@ public class HammingDistanceTest {
|
||||
public void mismatchDataBits() {
|
||||
String senderBits = "100010", receiverBits = "00011";
|
||||
|
||||
Exception ex = org.junit.jupiter.api.Assertions.assertThrows(IllegalArgumentException.class,
|
||||
() -> { int answer = hd.getHammingDistanceBetweenBits(senderBits, receiverBits); });
|
||||
Exception ex = org.junit.jupiter.api.Assertions.assertThrows(IllegalArgumentException.class, () -> { int answer = hd.getHammingDistanceBetweenBits(senderBits, receiverBits); });
|
||||
|
||||
Assertions.assertThat(ex.getMessage()).contains("bits should be same");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkForLongDataBitsSame() {
|
||||
String senderBits = "10010101101010000100110100",
|
||||
receiverBits = "10010101101010000100110100";
|
||||
String senderBits = "10010101101010000100110100", receiverBits = "10010101101010000100110100";
|
||||
int answer = hd.getHammingDistanceBetweenBits(senderBits, receiverBits);
|
||||
Assertions.assertThat(answer).isEqualTo(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user