public boolean isFluent() { if (description.getTestMethod() != null) { Step step = description.getTestMethod().getAnnotation(Step.class); return ((step != null) && (step.fluent())); } return false; }
public Method getTestMethod() { if (getTestClass() != null) { return methodCalled(withNoArguments(description.getName()), getTestClass()); } else { return null; } }
public String getName() { if (noClassIsDefined()) { return description.getName(); } else if (isAGroup()) { return groupName(); } else { return stepName(); } }
private void allStepDefinitionFieldsShouldBeResolvedIn(String stepDescription) { Map<String, Object> fields = description.getDisplayedFields(); for (String field : fields.keySet()) { if (stepDescription.contains(fieldNameFor(field))) { throw new AssertionError( stepDescription + " : " + field + " value could not be resolved"); } } }
private String annotatedStepNameWithParameters(String annotatedStepTemplate) { String annotatedStepName = annotatedStepTemplate; Iterable<String> parameters = getParamatersFrom(description.getName()); int counter = 0; for (String parameter : parameters) { String token = "{" + counter++ + "}"; annotatedStepName = StringUtils.replace(annotatedStepName, token, parameter); } return annotatedStepName; }
private String stepName() { String annotationTitle = getAnnotatedTitle(); if (!StringUtils.isEmpty(annotationTitle)) { return annotationTitle; } Optional<String> annotatedStepName = getAnnotatedStepName(); if (getAnnotatedStepName().isPresent() && (StringUtils.isNotEmpty(annotatedStepName.get()))) { return annotatedStepNameWithParameters(annotatedStepName.get()); } return humanize(description.getName()); }
public String into(String stepDescription) { Map<String, Object> fields = description.getDisplayedFields(); for (String field : fields.keySet()) { String fieldName = fieldNameFor(field); Object value = fields.get(field); if (stepDescription.contains(fieldName) && (value != UNDEFINED)) { stepDescription = StringUtils.replace(stepDescription, fieldNameFor(field), stringValueFor(value)); } } // allStepDefinitionFieldsShouldBeResolvedIn(stepDescription); return stepDescription; }
private Class<?> getTestClass() { return description.getStepClass(); }
public Method getTestMethodIfPresent() { return findMethodCalled(withNoArguments(description.getName()), getTestClass()); }
private boolean noClassIsDefined() { return description.getStepClass() == null; }