コード例 #1
0
ファイル: Runtime.java プロジェクト: bap2000/cucumber-jvm
  /**
   * @return a list of code snippets that the developer can use to implement undefined steps. This
   *     should be displayed after a run.
   */
  public List<String> getSnippets() {
    // TODO: Convert "And" and "But" to the Given/When/Then keyword above.
    Collections.sort(
        undefinedSteps,
        new Comparator<Step>() {
          public int compare(Step a, Step b) {
            int keyword = a.getKeyword().compareTo(b.getKeyword());
            if (keyword == 0) {
              return a.getName().compareTo(b.getName());
            } else {
              return keyword;
            }
          }
        });

    List<String> snippets = new ArrayList<String>();
    for (Step step : undefinedSteps) {
      for (Backend backend : backends) {
        String snippet = backend.getSnippet(step);
        if (!snippets.contains(snippet)) {
          snippets.add(snippet);
        }
      }
    }
    return snippets;
  }
コード例 #2
0
ファイル: Btransferpair.java プロジェクト: MOhannadAbdo15/Q-A
  // Test the change plan when trying to change a student plan
  @Test
  public void transferpairtest() {
    Backend b = new Backend();
    String[] args = new String[1];
    args[0] = "MasterBankAccounts.txt";

    tlist.clear();

    Transaction t = new Transaction();
    t.setCode("10");
    t.setMisc("A");
    t.setName("");

    Transaction t2 = new Transaction();
    t2.setCode("02");
    t2.setNum("00005");

    Transaction t3 = new Transaction();
    t3.setCode("00");

    tlist.add(t);
    tlist.add(t2);
    tlist.add(t3);

    b.load(args);
    b.setTransactions(tlist);
    b.handletransactions();
    assertEquals("Transfer transactions must come in pairs\n", outContent.toString());
  }
コード例 #3
0
ファイル: Runtime.java プロジェクト: bap2000/cucumber-jvm
 private List<StepDefinitionMatch> stepDefinitionMatches(String uri, Step step) {
   List<StepDefinitionMatch> result = new ArrayList<StepDefinitionMatch>();
   for (Backend backend : backends) {
     for (StepDefinition stepDefinition : backend.getStepDefinitions()) {
       List<Argument> arguments = stepDefinition.matchedArguments(step);
       if (arguments != null) {
         result.add(
             new StepDefinitionMatch(
                 arguments, stepDefinition, uri, step, localizedXStreams, tableHeaderMapper));
       }
     }
   }
   return result;
 }