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.
This commit is contained in:
Michael Bayne
2017-04-25 08:43:19 -07:00
parent 4855057b2a
commit 02975c107e
@@ -3,27 +3,27 @@
// Copyright (C) 2004-2016 Getdown authors // Copyright (C) 2004-2016 Getdown authors
// https://github.com/threerings/getdown/blob/master/LICENSE // https://github.com/threerings/getdown/blob/master/LICENSE
package com.threerings.getdown.data; package com.threerings.getdown.util;
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
public class SysPropsTest public class VersionUtilTest {
{
@Test @Test
public void shouldParseJavaVersion () public void shouldParseJavaVersion ()
{ {
long version = SysProps.parseJavaVersion( long version = VersionUtil.parseJavaVersion(
"java.version", "(\\d+)\\.(\\d+)\\.(\\d+)(_\\d+)?"); "(\\d+)\\.(\\d+)\\.(\\d+)(_\\d+)?", "1.8.0_152");
assertTrue(version > 1060000); assertTrue(version > 1060000);
} }
@Test @Test
public void shouldParseJavaRuntimeVersion () public void shouldParseJavaRuntimeVersion ()
{ {
long version = SysProps.parseJavaVersion( long version = VersionUtil.parseJavaVersion(
"java.runtime.version", "(\\d+)\\.(\\d+)\\.(\\d+)(_\\d+)?(-b\\d+)?"); "(\\d+)\\.(\\d+)\\.(\\d+)(_\\d+)?(-b\\d+)?", "1.8.0_131-b11");
assertTrue(version > 106000000); assertTrue(version > 106000000);
} }
} }