コード例 #1
0
 private void createStory(Description description) {
   if (description.getAnnotation(Story.class) != null)
     createStoryFromAnnotation(description.getAnnotation(Story.class));
   else {
     createStoryFromDescription(description.getDisplayName());
   }
 }
コード例 #2
0
  private ScenarioModel namedScenario(Description description) {
    Scenario scenarioAnnotation = description.getAnnotation(Scenario.class);
    Parameters parametersAnnotation = description.getAnnotation(Parameters.class);
    String name = null;

    if (scenarioHasDefinedName(scenarioAnnotation)) name = scenarioAnnotation.value();
    else name = createScenarioNameFromTestMethodName(description, parametersAnnotation);

    if (parametersAnnotation != null && !scenarioAnnotation.pending())
      name =
          name.substring(name.indexOf('(') + 1, name.indexOf(')'))
              + " ("
              + description
                  .getMethodName()
                  .substring(0, description.getMethodName().indexOf('(') - 1)
              + ")";

    return ScenarioManager.currentScenario().withName(name).withDescription(description);
  }