Skip to content

Commit b1aeb9b

Browse files
committed
Disabling a test in Java 5 because it relies on platform support for MXBeans.
1 parent 24bf779 commit b1aeb9b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/test/com/mongodb/tools/ConnectionPoolStatTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,23 @@ public class ConnectionPoolStatTest extends TestCase {
2828

2929
@Test
3030
public void testBasic() throws IOException, JMException {
31+
if (!isAtLeastJava6()) {
32+
return;
33+
}
3134
ConnectionPoolStat stat = new ConnectionPoolStat();
3235
String stats = stat.getStats();
3336
assertNotNull(stats);
3437
DBObject obj = (DBObject) JSON.parse(stats);
3538
assertNotNull(obj);
3639
}
40+
41+
private boolean isAtLeastJava6() {
42+
String javaSpecificationVersion = System.getProperty("java.specification.version");
43+
String minorVersionString = javaSpecificationVersion.substring(javaSpecificationVersion.lastIndexOf(".") + 1);
44+
try {
45+
return Integer.parseInt(minorVersionString) >= 6;
46+
} catch (NumberFormatException e) {
47+
return false;
48+
}
49+
}
3750
}

0 commit comments

Comments
 (0)