File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
src/test/com/mongodb/tools Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments