net.thucydides.core.requirements.PathStartsWith Maven / Gradle / Ivy
package net.thucydides.core.requirements;
import java.util.List;
class PathStartsWith {
private List storyPathElements;
public PathStartsWith(List storyPathElements) {
this.storyPathElements = storyPathElements;
}
public boolean startsWith(List rootElements) {
if (storyPathElements.size() >= rootElements.size()) {
int elementIndex = 0;
for(String pathElement : rootElements) {
if (!pathElement.equals(storyPathElements.get(elementIndex++))) {
return false;
}
}
return true;
} else {
return false;
}
}
}