-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolutionTest.java
More file actions
31 lines (22 loc) · 836 Bytes
/
SolutionTest.java
File metadata and controls
31 lines (22 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package string.sumbin;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.jupiter.api.Test;
public class SolutionTest {
private final Solution solution = new Solution();
@Test
public void addBinary_TwoNumbers_ExpectedSum() {
String result = solution.addBinary("110", "101");
assertThat(result).isEqualTo("1011");
result = solution.addBinary("0", "0");
assertThat(result).isEqualTo("0");
result = solution.addBinary("111", "0");
assertThat(result).isEqualTo("111");
}
@Test
public void addBinary_TwoNumbers_HandleSumCarry() {
String result = solution.addBinary("1111", "1");
assertThat(result).isEqualTo("10000");
result = solution.addBinary("11", "11");
assertThat(result).isEqualTo("110");
}
}