package hex.tree.xgboost;

import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.ClearSystemProperties;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;

public class XGBoostModelMaxThreadsTest {

    @Rule
    public final ClearSystemProperties clearPropertyRule = new ClearSystemProperties("sys.ai.h2o.xgboost.nthreadMax");

    @Test
    public void shouldRespectPropertyOverride() {
        int original = XGBoostModel.getMaxNThread();
        assertNotEquals(original, 2); // just make sure the property will actually change things
        System.setProperty("sys.ai.h2o.xgboost.nthreadMax", "2");
        assertEquals(2, XGBoostModel.getMaxNThread());
    }

}

@@ -20,16 +20,41 @@
 boost;%0A%0A
+import org.junit.Assume;%0A
 import o
@@ -68,16 +68,16 @@
 t.Rule;%0A
-
 import o
@@ -205,56 +205,8 @@
 als;
-%0Aimport static org.junit.Assert.assertNotEquals;
 %0A%0Apu
@@ -501,23 +501,25 @@
     
-assertNotEquals
+Assume.assumeTrue
 (ori
@@ -527,72 +527,15 @@
 inal
-,
+ %3E=
  2);
- // just make sure the property will actually change things
 %0A   
@@ -595,11 +595,36 @@
 x%22, 
-%222%22
+String.valueOf(original / 2)
 );%0A 
@@ -643,16 +643,27 @@
 tEquals(
+original / 
 2, XGBoo

make xgboost max threads test more stable (#4410)