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