| 41 | class TupleTest { |
| 42 | |
| 43 | @Test |
| 44 | void testTuples() { |
| 45 | Pair<String, Integer> pair = new Pair<>("A", 1); |
| 46 | Triplet<String, Integer, Long> triplet = new Triplet<>("B", 2, Long.MAX_VALUE); |
| 47 | Quartet<String, Integer, Long, Character> quartet = new Quartet<>("C", 3, Long.MIN_VALUE, 'c'); |
| 48 | Quintet<String, Integer, Long, Character, BigInteger> quintet = new Quintet<>("D", 4, Long.valueOf("0"), 'd', |
| 49 | BigInteger.ZERO); |
| 50 | |
| 51 | assertThat("pair.getA() should be A", pair.getA(), is("A")); |
| 52 | assertThat("triplet.getA() should be B", triplet.getA(), is("B")); |
| 53 | assertThat("quartet.getA() should be C", quartet.getA(), is("C")); |
| 54 | assertThat("quintet.getA() should be D", quintet.getA(), is("D")); |
| 55 | |
| 56 | assertThat("pair.getB().intValue() should be 1", pair.getB().intValue(), is(1)); |
| 57 | assertThat("triplet.getB().intValue() should be 2", triplet.getB().intValue(), is(2)); |
| 58 | assertThat("quartet.getB().intValue() should be 3", quartet.getB().intValue(), is(3)); |
| 59 | assertThat("quintet.getB().intValue() should be 4", quintet.getB().intValue(), is(4)); |
| 60 | |
| 61 | assertThat("triplet.getC().longValue() should be Long.MAX_VALUE", triplet.getC().longValue(), |
| 62 | is(Long.MAX_VALUE)); |
| 63 | assertThat("quartet.getC().longValue() should be Long.MIN_VALUE", quartet.getC().longValue(), |
| 64 | is(Long.MIN_VALUE)); |
| 65 | assertThat("quintet.getC().longValue() should be 0L", quintet.getC().longValue(), is(0L)); |
| 66 | |
| 67 | assertThat("quartet.getD().charValue() should be c", quartet.getD().charValue(), is('c')); |
| 68 | assertThat("quintet.getD().charValue() should be d", quintet.getD().charValue(), is('d')); |
| 69 | |
| 70 | assertThat("quintet.getE() should be BigInteger.ZERO", quintet.getE(), is(BigInteger.ZERO)); |
| 71 | } |
| 72 | } |