Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  
  package sirius.utils.retriever.formatters;
  
  import java.io.File;
  import java.io.FileWriter;
 
 

Author(s):
Myk Kolisnyk
 
 public class CucumberFormatter implements IStoryFormatter {
 
     private String      outDir  = ".";
     private String      outFile = "";
 
     public final String eol     = System.getProperty("line.separator");
     public final String fs      = System.getProperty("file.separator");
 
     public CucumberFormatter(final String outputLocation) {
         this. = outputLocation;
     }
 
     private String cleanIssueBody(String body) {
         HashMap<StringStringmap = new HashMap<StringString>();
 
         map.put("\\*\\*Scenario Outline:\\*\\*""Scenario Outline:");
         map.put("\\*\\*Scenario:\\*\\*""Scenario:");
         map.put("\\*\\*Examples:\\*\\*""Examples:");
 
         for (String key : map.keySet()) {
             body = body.replaceAll(keymap.get(key));
         }
 
         return body;
     }
 
     /*
      * (non-Javadoc)
      * 
      * @see
      * sirius.utils.retriever.interfaces.IStoryFormatter#GetFooter(java.util
      * .ArrayList)
      */
     public String GetFooter(final ArrayList<GHIssueissues) {
         return "";
     }
 
     /*
      * (non-Javadoc)
      * 
      * @see
      * sirius.utils.retriever.interfaces.IStoryFormatter#GetHeader(java.util
      * .ArrayList)
      */
     public String GetHeader(final ArrayList<GHIssueissues) {
 
         return "";
     }
 
     /*
      * (non-Javadoc)
      * 
      * @see
      * sirius.utils.retriever.interfaces.IStoryFormatter#GetIssue(org.kohsuke
      * .github.GHIssue)
      */
     public String GetIssue(final GHIssue issue) {
         try {
              =  + 
                     + issue.getTitle().replaceAll(" """).replaceAll(":""_")
                     + ".feature";
             FileWriter writer = new FileWriter();
 
             GHMilestone milestone = issue.getMilestone();
             if (milestone != null) {
                 writer.write("# Requirement: "
                         + milestone.getTitle()
                         + 
                         + "# "
                         + milestone.getDescription()
                                 .replaceAll( + "# ") +  + "# URL: "
                         + milestone.getUrl() + );
             } else {
                 writer.write("");
             }
             writer.close();
         } catch (IOException e) {
             e.printStackTrace();
         }
        return GetLabels(issue) +  + "Feature: " + issue.getTitle() + 
                + "\tURL: <a href=\"" + issue.getUrl() + "\">" + issue.getUrl()
                + "</a>" +  + cleanIssueBody(issue.getBody()) + ;
    }
    /*
     * (non-Javadoc)
     * 
     * @see
     * sirius.utils.retriever.interfaces.IStoryFormatter#GetLabels(org.kohsuke
     * .github.GHIssue)
     */
    public String GetLabels(final GHIssue issue) {
        String result = "";
        String[] labels = new String[issue.getLabels().size()];
        issue.getLabels().toArray(labels);
        for (int i = 4; i < labels.lengthi += 8) {
            result += "@" + labels[i] + " ";
        }
        return result;
    }
    /*
     * (non-Javadoc)
     * 
     * @see
     * sirius.utils.retriever.interfaces.IStoryFormatter#GetMilestone(org.kohsuke
     * .github.GHMilestone)
     */
    public String GetMilestone(final GHMilestone milestone) {
        return "";
    }
    /*
     * (non-Javadoc)
     * 
     * @see
     * sirius.utils.retriever.interfaces.IStoryFormatter#Out(java.lang.String)
     */
    public void Out(final String text) {
        FileWriter writer;
        try {
            File file = new File();
            if (!file.exists()) {
                // System.out.println("File '" + outFile + "' wasn't found");
                return;
            }
            writer = new FileWriter(true);
            writer.append(text);
            writer.close();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
New to GrepCode? Check out our FAQ X