Gepir
8 years agoOccasional Contributor
Call Java class with variable in groovy
Hi all... I need to call java class and send variable in to. I know how to call class. my code: def oliNum="1234567890"
Ticket newTicket = TicketTestUtil.generateTicket();
log.info newTic...
- 8 years ago
Here are the changes needed in your java class:
#1 from
public static Ticket generateTicket() {
To
public static Ticket generateTicket(String oliNumber) {
#2 from
ticket.setOliNumber("4778077007");
To
ticket.setOliNumber(oliNumber);
In the groovy script, you should be able to call
Change from
Ticket newTicket = TicketTestUtil.generateTicket()
To:
Ticket newTicket = TicketTestUtil.generateTicket(oliNumber)