Karate How to Escape quotes in data you're passing to a Java type call

拈花ヽ惹草 提交于 2019-12-25 17:37:50

问题


This is related to this Karate Java Function problems

So I have a feature that calls a java method that makes a query to a database and it passes data to that method but as not all the data is made of only numbers I have to put it in quotes "Something" but the method also gets the quotes and that results in my query to be empty, how can I escape the quotes to avoid receiving empty results?

Backslashes in def query = sql.identificacionCliente('<numeroCuenta>') don't work.


回答1:


Mi inexperience shows, i had a bad concept about what the character escaping was for therefore i was asking the wrong question.

For a solution for this particular case in the example you would have something like this: e.g

|numeroCuenta|
|12345678K   |
|123456789   |

just put the one that has letters in simple quotes and then remove the simple quotes on the method call. e.g

|numeroCuenta|
|'12345678K' |
|123456789   |

Before

def query = sql.identificacionCliente('<numeroCuenta>')

After

def query = sql.identificacionCliente(<numeroCuenta>)


来源:https://stackoverflow.com/questions/58826607/karate-how-to-escape-quotes-in-data-youre-passing-to-a-java-type-call

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!