Giter Club home page Giter Club logo

Comments (8)

EQuincerot avatar EQuincerot commented on June 17, 2024 1

Thanks for the example, it's helpful!
We'll investigate and try to find a fix.

from jenkinspipelineunit.

ozangunalp avatar ozangunalp commented on June 17, 2024

Hi @kpdroiddev,

At first glace it seems like an issue with searching methods with parameter default values. I'll take a look as soon as I can. Meanwhile can you remove default values from your call method definition and see what it gives ?

Thanks,

from jenkinspipelineunit.

KorbinianP avatar KorbinianP commented on June 17, 2024

Hello @ozangunalp,
thank you very much! I tried but it is still the same:

//In sayHello.groovy
def call(String name, String secondname) {
MethodSignature{ name='sayHello', args=[class java.lang.String, class java.lang.String] }=com.lesfurets.jenkins.unit.PipelineTestHelper$_setGlobalVars_closure9$_closure18$_closure19@6caf0677
groovy.lang.MissingMethodException: No signature of method: com.lesfurets.jenkins.unit.PipelineTestHelper$_setGlobalVars_closure9$_closure18$_closure19.call() is applicable for argument types: (java.lang.String, java.lang.String) values: [Some, String]
Possible solutions: any(), any(), find(), collect(), grep(), dump()

java.lang.NullPointerException: Cannot get property 'Stage' on null object

	at org.codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:60)
	at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:172)
	at org.codehaus.groovy.runtime.DefaultGroovyMethods.getAt(DefaultGroovyMethods.java:257)
	at org.codehaus.groovy.runtime.dgm$241.invoke(Unknown Source)
	at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoMetaMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:251)
	at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:71)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
	at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:35)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
	at Jenkinsfile_testReportError$_run_closure1.doCall(Jenkinsfile_testReportError:45)

from jenkinspipelineunit.

EQuincerot avatar EQuincerot commented on June 17, 2024

Hello @kpdroiddev

Thanks for your response. However I cannot reproduce the issue you mention.
Could you maybe create a test in this project to reproduce the issue or send us an example in a private message?

I see you have a NullPointerException as well, occuring in Jenkinsfile_testReportError:45
It seems you get 'Stage' on a null object. Did you mock the object containing the stage correctly?

Thanks for your feedback.

from jenkinspipelineunit.

KorbinianP avatar KorbinianP commented on June 17, 2024

Hello @EQuincerot ,

I don't know where the NullPointer comes from as if I try with only one parameter the test passes.
But to be sure I created a new test case based on your files, in your project and tried it, still the same. I will attach the files.

Cheers and thanks for the support!
Reproduce_Bug21.zip

from jenkinspipelineunit.

KorbinianP avatar KorbinianP commented on June 17, 2024

Hello @EQuincerot ,

I tried your Branch "Remove branch encapsulation" and it works smooth for me, thank you for the quick fix!
Cheers

from jenkinspipelineunit.

EQuincerot avatar EQuincerot commented on June 17, 2024

Thanks for the quick feedback @kpdroiddev !

from jenkinspipelineunit.

fl-max avatar fl-max commented on June 17, 2024

For anyone stumbling up this; this appears to only work when you have default values set in your def call(...) method.

from jenkinspipelineunit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.