Code cleanup (#4246)

This commit is contained in:
HManiac74
2023-07-22 17:23:00 +02:00
committed by GitHub
parent 3facb0d862
commit 2488a2ad51
52 changed files with 50 additions and 167 deletions

View File

@ -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);

View File

@ -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");
}