mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-28 15:02:46 +08:00
Code cleanup (#4246)
This commit is contained in:
@ -14,7 +14,7 @@ class CRC16Test {
|
||||
String textToCRC16 = "hacktoberfest!";
|
||||
|
||||
// when
|
||||
String resultCRC16 = crc.crc16(textToCRC16); // Algorithm CRC16-CCITT-FALSE
|
||||
String resultCRC16 = CRC16.crc16(textToCRC16); // Algorithm CRC16-CCITT-FALSE
|
||||
|
||||
// then
|
||||
assertEquals("10FC", resultCRC16);
|
||||
|
@ -1,8 +1,6 @@
|
||||
package com.thealgorithms.others.cn;
|
||||
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.assertj.core.api.ThrowableTypeAssert;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class HammingDistanceTest {
|
||||
@ -42,14 +40,14 @@ public class HammingDistanceTest {
|
||||
|
||||
@Test
|
||||
public void mismatchDataBits() {
|
||||
Exception ex = org.junit.jupiter.api.Assertions.assertThrows(IllegalArgumentException.class, () -> { int answer = HammingDistance.compute("100010", "00011"); });
|
||||
Exception ex = org.junit.jupiter.api.Assertions.assertThrows(IllegalArgumentException.class, () -> { HammingDistance.compute("100010", "00011"); });
|
||||
|
||||
Assertions.assertThat(ex.getMessage()).contains("must have the same length");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mismatchDataBits2() {
|
||||
Exception ex = org.junit.jupiter.api.Assertions.assertThrows(IllegalArgumentException.class, () -> { int answer = HammingDistance.compute("1", "11"); });
|
||||
Exception ex = org.junit.jupiter.api.Assertions.assertThrows(IllegalArgumentException.class, () -> { HammingDistance.compute("1", "11"); });
|
||||
|
||||
Assertions.assertThat(ex.getMessage()).contains("must have the same length");
|
||||
}
|
||||
@ -77,7 +75,7 @@ public class HammingDistanceTest {
|
||||
|
||||
@Test
|
||||
public void computeThrowsExceptionWhenInputsAreNotBitStrs() {
|
||||
Exception ex = org.junit.jupiter.api.Assertions.assertThrows(IllegalArgumentException.class, () -> { int answer = HammingDistance.compute("1A", "11"); });
|
||||
Exception ex = org.junit.jupiter.api.Assertions.assertThrows(IllegalArgumentException.class, () -> { HammingDistance.compute("1A", "11"); });
|
||||
|
||||
Assertions.assertThat(ex.getMessage()).contains("must be a binary string");
|
||||
}
|
||||
|
Reference in New Issue
Block a user