| 1 | package nl.timfalken.chestpreview; |
| 2 | |
| 3 | import java.util.UUID; |
| 4 | |
| 5 | import org.junit.jupiter.api.Test; |
| 6 | |
| 7 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 8 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 9 | |
| 10 | class BlockKeyTest { |
| 11 | |
| 12 | @Test |
| 13 | void compareToOrdersByWorldThenCoordinates() { |
| 14 | UUID a = UUID.fromString("00000000-0000-0000-0000-000000000001"); |
| 15 | UUID b = UUID.fromString("00000000-0000-0000-0000-000000000002"); |
| 16 | BlockKey origin = new BlockKey(a, 0, 64, 0); |
| 17 | BlockKey higher = new BlockKey(a, 0, 65, 0); |
| 18 | BlockKey otherWorld = new BlockKey(b, 0, 64, 0); |
| 19 | assertEquals(0, origin.compareTo(new BlockKey(a, 0, 64, 0))); |
| 20 | assertTrue(origin.compareTo(higher) < 0); |
| 21 | assertTrue(higher.compareTo(origin) > 0); |
| 22 | assertTrue(origin.compareTo(otherWorld) < 0); |
| 23 | } |
| 24 | } |