All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jspringbot.keyword.xml.AddXMLAttribute Maven / Gradle / Ivy

There is a newer version: 1.9
Show newest version
package org.jspringbot.keyword.xml;

import org.jspringbot.KeywordInfo;
import org.springframework.stereotype.Component;

@Component
@KeywordInfo(
        name = "Add XML Attribute",
        parameters = {"name", "value"},
        description = "classpath:desc/AddXMLAttribute.txt"
)
public class AddXMLAttribute extends AbstractXMLKeyword {

    @Override
    public Object execute(Object[] params) {
        String name = String.valueOf(params[0]);
        String value = String.valueOf(params[1]);

        try {
            builderHelper.addAttribute(name, value);
        } catch (Exception e) {
            throw new IllegalArgumentException(String.format("Error adding attribute name=%s, value=%s.", name, value));
        }

        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy