mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-24 11:45:31 +01:00
Added Pair junit test
This commit is contained in:
parent
44ed33bb26
commit
81e8d7da67
49
src/test/java/us/tastybento/bskyblock/util/PairTest.java
Normal file
49
src/test/java/us/tastybento/bskyblock/util/PairTest.java
Normal file
@ -0,0 +1,49 @@
|
||||
package us.tastybento.bskyblock.util;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class PairTest {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
}
|
||||
|
||||
@Test
|
||||
public final void testHashCode() {
|
||||
Pair<Integer, Integer> pair = new Pair<>(1,2);
|
||||
Pair<Integer, Integer> pair2 = new Pair<>(1,2);
|
||||
assertTrue(pair.hashCode() == pair2.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public final void testPair() {
|
||||
Pair<Integer, Integer> pair = new Pair<>(1,2);
|
||||
assertEquals(Integer.valueOf(1), pair.x);
|
||||
assertEquals(Integer.valueOf(2), pair.z);
|
||||
}
|
||||
|
||||
@Test
|
||||
public final void testToString() {
|
||||
Pair<Integer, Integer> pair = new Pair<>(1,2);
|
||||
assertEquals("Pair [x=1, z=2]", pair.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public final void testEqualsObject() {
|
||||
Pair<Integer, Integer> pair = new Pair<>(1,2);
|
||||
Pair<String, String> pair2 = new Pair<>("1","2");
|
||||
Pair<Integer, Integer> pair3 = new Pair<>(1,2);
|
||||
Pair<Integer, Integer> pair4 = new Pair<>(1,null);
|
||||
Pair<Integer, Integer> pair5 = new Pair<>(null,2);
|
||||
assertTrue(pair.equals(pair));
|
||||
assertTrue(pair.equals(pair3) && pair3.equals(pair));
|
||||
assertFalse(pair.equals(pair2));
|
||||
assertFalse(pair.equals(pair4));
|
||||
assertFalse(pair.equals(pair5));
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user