Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-59762

Static initialization block prevents mocking CpsThread

XMLWordPrintable

      This causes trouble for scripted pipelines testing, e.g. when using jenkins-spock library:

      Could not initialize class org.jenkinsci.plugins.workflow.cps.CpsThread
      java.lang.NoClassDefFoundError: Could not initialize class org.jenkinsci.plugins.workflow.cps.CpsThread
      	at org.jenkinsci.plugins.workflow.cps.CpsScript.<init>(CpsScript.java:69)
      	at org.spockframework.mock.runtime.MockInstantiator.instantiate(MockInstantiator.java:33)
      	at org.spockframework.mock.runtime.ProxyBasedMockFactory$CglibMockFactory.createMock(ProxyBasedMockFactory.java:155)
      	at org.spockframework.mock.runtime.ProxyBasedMockFactory.create(ProxyBasedMockFactory.java:68)
      	at org.spockframework.mock.runtime.JavaMockFactory.createInternal(JavaMockFactory.java:59)
      	at org.spockframework.mock.runtime.JavaMockFactory.create(JavaMockFactory.java:40)
      	at org.spockframework.mock.runtime.CompositeMockFactory.create(CompositeMockFactory.java:44)
      	at org.spockframework.lang.SpecInternals.createMock(SpecInternals.java:51)
      	at org.spockframework.lang.SpecInternals.createMockImpl(SpecInternals.java:296)
      	at org.spockframework.lang.SpecInternals.createMockImpl(SpecInternals.java:286)
      	at org.spockframework.lang.SpecInternals.SpyImpl(SpecInternals.java:161)
      	at com.homeaway.devtools.jenkins.testing.JenkinsPipelineSpecification.setup(JenkinsPipelineSpecification.groovy:1025)
      

            Unassigned Unassigned
            kamilszymanski Kamil SzymaƄski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: