package jenkins.util;

import hudson.slaves.DumbSlave;
import java.io.IOException;
import jenkins.security.MasterToSlaveCallable;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;

import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

public class JenkinsJVMRealTest {

    @ClassRule
    public static JenkinsRule j = new JenkinsRule();

    @Test
    public void isJenkinsJVM() throws Exception {
        assertThat(new IsJenkinsJVM().call(), is(true));
        DumbSlave slave = j.createOnlineSlave();
        assertThat(slave.getChannel().call(new IsJenkinsJVM()), is(false));
    }

    public static class IsJenkinsJVM extends MasterToSlaveCallable<Boolean, IOException> {

        @Override
        public Boolean call() throws IOException {
            return JenkinsJVM.isJenkinsJVM();
        }
    }

}

@@ -476,25 +476,25 @@
  throws 
-Exception
+Throwable
  %7B%0A     

Fix error with 1.8.0_77 in CI, does not happen with 1.8.0_121