Example #1
0
  /**
   * @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;
  }
Example #2
0
  // 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());
  }
Example #3
0
 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;
 }