Skip to content

Commit 20125a2

Browse files
committed
Removed unused code.
1 parent 5b1b62c commit 20125a2

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed
Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package stringbasic.exercises;
22

3-
import java.util.Objects;
4-
53
/**
64
* Pair container for int elements
75
*/
@@ -10,10 +8,6 @@ public class IntPair {
108
private int first;
119
private int second;
1210

13-
public IntPair() {
14-
15-
}
16-
1711
public IntPair(int first, int second) {
1812
this.first = first;
1913
this.second = second;
@@ -23,18 +17,10 @@ public int getFirst() {
2317
return first;
2418
}
2519

26-
public void setFirst(int first) {
27-
this.first = first;
28-
}
29-
3020
public int getSecond() {
3121
return second;
3222
}
3323

34-
public void setSecond(int second) {
35-
this.second = second;
36-
}
37-
3824
@Override
3925
public boolean equals(Object o) {
4026
if (this == o) return true;
@@ -43,9 +29,4 @@ public boolean equals(Object o) {
4329
return getFirst() == intPair.getFirst() &&
4430
getSecond() == intPair.getSecond();
4531
}
46-
47-
@Override
48-
public int hashCode() {
49-
return Objects.hash(getFirst(), getSecond());
50-
}
5132
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package stringbasic.exercises;
2+
3+
import org.junit.Assert;
4+
import org.junit.Test;
5+
6+
public class IntPairTest {
7+
8+
@Test
9+
public void testConstructor() {
10+
IntPair firstPair = new IntPair(2,4);
11+
IntPair equalPair = new IntPair(2,4);
12+
IntPair differentPair = new IntPair(3,5);
13+
Assert.assertTrue(firstPair.equals(equalPair));
14+
Assert.assertTrue(firstPair.equals(firstPair));
15+
Assert.assertFalse(firstPair.equals(differentPair));
16+
Assert.assertFalse(firstPair.equals(null));
17+
Assert.assertFalse(firstPair.equals("not a pair"));
18+
}
19+
}

0 commit comments

Comments
 (0)