I want to convert following if-else loop into Switch case where i want Boolean conditions to be converted.
public String getRandomValues(WebElement input) {
String value;
if (input.getAttribute("id").equalsIgnoreCase("FIRSTNAME")) {
value = "User";
} else if (input.getAttribute("id").equalsIgnoreCase("LASTNAME")) {
value = "Name";
} else if (input.getAttribute("id").equalsIgnoreCase("ACCOUNTNUMBER")) {
value = "0123945486855";
} else if (input.getAttribute("id").equalsIgnoreCase("EMAIL")) {
value = "user@domain.com";
} else if (input.getAttribute("id").equalsIgnoreCase("PHONE")) {
value = "98287825858";
} else if (input.getAttribute("id").equalsIgnoreCase("DATE")) {
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
value = dateFormat.format(new Date());
} else {
value = "Random Value 123";
}
return value;
}
Can anyone help ?
Aucun commentaire:
Enregistrer un commentaire