Forum Discussion

Paramanand_Ghod's avatar
Paramanand_Ghod
Contributor
16 years ago

No signature of method Error

Hi,

When I am trying to run the below groovy script, SOAP UI throws an error "No signature of method: static java.lang.Integer.parseInt() is applicable for argument types: (java.lang.Integer) values: [2000]".

def CharInt = I have 2000 bucks
def count = Integer.parseInt(varInt)

Please help!

Thanks,
Param

3 Replies

  • Hello,

    I'm not quite sure what your script is supposed to do, but as it is posted, it contains several errors.

    def CharInt = I have 2000 bucks

    You need quotation marks around this string for it to be a string, like this:
    def CharInt = "I have 2000 bucks"


    def count = Integer.parseInt(varInt)

    This line may or may not be correct, depending on what varInt is. If you meant the CharInt variable from the line before, this would be invalid, as the string given cannot be parsed into an integer, due to the non-numerical values in it. However, given the error you say you get: "No signature of method: static java.lang.Integer.parseInt() is applicable for argument types: (java.lang.Integer) values: [2000]", it instead seems that the contents of varInt is already an integer. Trying to parse an int from an int is redundant (it's already an int), so there is no method for doing so, which is why you're getting that error.

    The Integer.parseInt() method can take a String containing a valid integer value, for example: "2000".

    Regards,
    Dain
    eviware.com
  • Thanks for the explanation. I appreciate!

    My aim is to verify a value is an Integer or String. How can we do that?

    Thanks,
    Param
  • Hello,

    That depends on where you are getting the value from. It's hard for me to help you with so little to go on. Could you perhaps provide your full script, or at least a description of what it is you are trying to achieve? Where are these variables that you wish to validate coming from?

    Regards,
    Dain
    eviware.com