Vitali Plagov
05/03/2023, 12:05 PMinterface SelenideElement {
SelenideElement should(Condition condition)
}
I made the following infix function
infix fun SelenideElement.should(condition: Condition) = this.should(condition)
Next, I want to create an infix function for the one from the Condition class. In the lib it is defined as this:
public abstract class Condition {
public static Condition text(String text) {
return new Text(text);
}
}
I tried this
infix fun Condition.text(message: String) = Text(message)
but in the end, it doesn't work like I would like it to be. My end goal is to have the following syntax:
selenideElement should text "hello"
selenideElement.shoould(text("hello"))
Wout Werkman
05/03/2023, 12:15 PMtext("hello")
using infix.Vitali Plagov
05/03/2023, 12:18 PM