From 02975c107ec544be848e0be9dba9e050f74f1d25 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Tue, 25 Apr 2017 08:43:19 -0700 Subject: [PATCH] Replace SysPropsTest with VersionUtilTest. As pointed out by soapyfrog, depending on info from the JVM running the test is fragile and not a good idea. Fixes #84. --- .../VersionUtilTest.java} | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) rename src/test/java/com/threerings/getdown/{data/SysPropsTest.java => util/VersionUtilTest.java} (59%) diff --git a/src/test/java/com/threerings/getdown/data/SysPropsTest.java b/src/test/java/com/threerings/getdown/util/VersionUtilTest.java similarity index 59% rename from src/test/java/com/threerings/getdown/data/SysPropsTest.java rename to src/test/java/com/threerings/getdown/util/VersionUtilTest.java index 342f4f6..1d6006e 100644 --- a/src/test/java/com/threerings/getdown/data/SysPropsTest.java +++ b/src/test/java/com/threerings/getdown/util/VersionUtilTest.java @@ -3,27 +3,27 @@ // Copyright (C) 2004-2016 Getdown authors // https://github.com/threerings/getdown/blob/master/LICENSE -package com.threerings.getdown.data; +package com.threerings.getdown.util; import org.junit.Test; import static org.junit.Assert.assertTrue; -public class SysPropsTest -{ +public class VersionUtilTest { + @Test public void shouldParseJavaVersion () { - long version = SysProps.parseJavaVersion( - "java.version", "(\\d+)\\.(\\d+)\\.(\\d+)(_\\d+)?"); + long version = VersionUtil.parseJavaVersion( + "(\\d+)\\.(\\d+)\\.(\\d+)(_\\d+)?", "1.8.0_152"); assertTrue(version > 1060000); } @Test public void shouldParseJavaRuntimeVersion () { - long version = SysProps.parseJavaVersion( - "java.runtime.version", "(\\d+)\\.(\\d+)\\.(\\d+)(_\\d+)?(-b\\d+)?"); + long version = VersionUtil.parseJavaVersion( + "(\\d+)\\.(\\d+)\\.(\\d+)(_\\d+)?(-b\\d+)?", "1.8.0_131-b11"); assertTrue(version > 106000000); } }