com.github.siwenyan.si.SiContextMonitorEvent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of side Show documentation
Show all versions of side Show documentation
Java runner of Selenium IDE project
package com.github.siwenyan.si;
public class SiContextMonitorEvent {
public static enum Type {
BEFORE_COMMAND, AFTER_COMMAND, BEFORE_TEST, AFTER_TEST
}
private final SiCommand siCommand;
private final SiTest siTest;
private final Type type;
public SiContextMonitorEvent(SiCommand siCommand, SiTest siTest, Type type) {
this.siCommand = siCommand;
this.siTest = siTest;
this.type = type;
}
public SiTest getSiTest() {
return this.siTest;
}
public Type getType() {
return this.type;
}
public String getName() {
String eventName = null;
switch (this.getType()) {
case BEFORE_COMMAND:
eventName = "before ";
eventName += this.siTest.getSiModelTest().getName();
eventName += "::" + this.siCommand.getSiModelCommand().getCommand();
eventName += "::" + this.siCommand.getSiModelCommand().getTarget();
break;
case AFTER_COMMAND:
eventName = "after ";
eventName += this.siTest.getSiModelTest().getName();
eventName += "::" + this.siCommand.getSiModelCommand().getCommand();
eventName += "::" + this.siCommand.getSiModelCommand().getTarget();
break;
case BEFORE_TEST:
eventName = "before ";
eventName += this.siTest.getSiModelTest().getName();
break;
case AFTER_TEST:
eventName = "after ";
eventName += this.siTest.getSiModelTest().getName();
break;
default:
//do nothing
}
return eventName;
}
@Override
public String toString() {
String s = this.getType().toString();
if (null != this.siCommand) {
s += "::" + this.siCommand.toString();
}
s += "::" + this.siTest.toString();
return s;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy