Modify test TestUuidGenerator to allow odd jvm variance in root error message

This commit is contained in:
Rob Bygrave
2022-01-27 09:12:57 +13:00
parent 1dc5ecc81f
commit 7278db56ea
@@ -85,7 +85,7 @@ public class TestUuidGenerator {
prop.store(os, "ebean uuid state file");
}
}
private Properties readPropertyFile() throws IOException {
Properties prop = new Properties();
try (InputStream is = new FileInputStream(stateFile)) {
@@ -108,7 +108,7 @@ public class TestUuidGenerator {
assertThat(Long.parseLong(props.getProperty("timeStamp")))
.isCloseTo(uuid.timestamp(), within(2_000_000L));
}
@Test
public void testUuidInvalidMac() throws Exception {
assertThatThrownBy(()-> UuidV1IdGenerator.getInstance(stateFile, "01-02-03-04-05"))
@@ -117,8 +117,7 @@ public class TestUuidGenerator {
assertThatThrownBy(()-> UuidV1IdGenerator.getInstance(stateFile, "01-02-03-04-05-GG"))
.isInstanceOf(IllegalArgumentException.class)
.hasMessageContaining("01-02-03-04-05-gg is invalid.")
.hasRootCauseInstanceOf(NumberFormatException.class)
.hasRootCauseMessage("For input string: \"gg\"");
.hasRootCauseInstanceOf(NumberFormatException.class);
assertThat(stateFile).doesNotExist();
}
@@ -170,7 +169,7 @@ public class TestUuidGenerator {
UUID uuid = gen.nextId(null);
assertThat(uuid).isNotNull();
}
@Test
public void testMacChange() throws Exception {
writePropertyFile("01-02-03-04-05", "1234", "1234");