com.github.dreamhead.moco.MocoEventTrigger Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of moco-core Show documentation
Show all versions of moco-core Show documentation
Moco is an easy setup stub framework, mainly focusing on testing and integration.
package com.github.dreamhead.moco;
public class MocoEventTrigger implements ConfigApplier{
private final MocoEvent event;
private final MocoEventAction action;
public MocoEventTrigger(final MocoEvent event, final MocoEventAction action) {
this.event = event;
this.action = action;
}
public boolean isFor(final MocoEvent event) {
return this.event == event;
}
public void fireEvent() {
action.execute();
}
@Override
public MocoEventTrigger apply(final MocoConfig config) {
MocoEventAction action = this.action.apply(config);
if (action != this.action) {
return new MocoEventTrigger(event, action);
}
return this;
}
}