コード例 #1
0
ファイル: RuntimeGlue.java プロジェクト: lxw03/cucumber-jvm
  @Override
  public void writeStepdefsJson(List<String> featurePaths, File dotCucumber) throws IOException {
    if (dotCucumber != null) {
      List<CucumberFeature> features = load(new FileResourceLoader(), featurePaths, NO_FILTERS);
      List<MetaStepdef> metaStepdefs =
          new StepdefGenerator().generate(stepDefinitionsByPattern.values(), features);
      Gson gson = new GsonBuilder().setPrettyPrinting().create();
      String json = gson.toJson(metaStepdefs);

      FileWriter stepdefsJson = new FileWriter(new File(dotCucumber, "stepdefs.json"));
      stepdefsJson.append(json);
      stepdefsJson.close();
    }
  }
コード例 #2
0
 @Override
 public String getMessage() {
   if (contentType.equals("application/json")) {
     Map map = gson.fromJson(super.getMessage(), Map.class);
     if (map.containsKey("error")) {
       return getMessage0(map.get("error").toString());
     } else {
       return getMessage0(super.getMessage());
     }
   } else {
     return getMessage0(super.getMessage());
   }
 }