Coverage Report - org.tap4j.parser.Memento
 
Classes in this File Line Coverage Branch Coverage Complexity
Memento
81%
27/33
N/A
1
 
 1  
 /*
 2  
  * The MIT License
 3  
  *
 4  
  * Copyright (c) <2012> <Bruno P. Kinoshita>
 5  
  * 
 6  
  * Permission is hereby granted, free of charge, to any person obtaining a copy
 7  
  * of this software and associated documentation files (the "Software"), to deal
 8  
  * in the Software without restriction, including without limitation the rights
 9  
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 10  
  * copies of the Software, and to permit persons to whom the Software is
 11  
  * furnished to do so, subject to the following conditions:
 12  
  * 
 13  
  * The above copyright notice and this permission notice shall be included in
 14  
  * all copies or substantial portions of the Software.
 15  
  * 
 16  
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 17  
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 18  
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 19  
  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 20  
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 21  
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 22  
  * THE SOFTWARE.
 23  
  */
 24  
 package org.tap4j.parser;
 25  
 
 26  
 import org.tap4j.model.TapElement;
 27  
 import org.tap4j.model.TestSet;
 28  
 
 29  
 /**
 30  
  * Memento for parsers. Stores information about a parser in certain moment 
 31  
  * of the parsing method.
 32  
  * 
 33  
  * @since 3.0
 34  
  */
 35  
 public class Memento {
 36  
 
 37  
     private boolean firstLine;
 38  
 
 39  
     private boolean planBeforeTestResult;
 40  
 
 41  
     private String lastLine;
 42  
 
 43  
     private TapElement lastParsedElement;
 44  
 
 45  
     /**
 46  
      * Indicator of the base indentation level. Usually defined by the TAP
 47  
      * Header.
 48  
      */
 49  
     private int baseIndentationLevel;
 50  
 
 51  
     /**
 52  
      * Helper indicator of in what indentantion level we are working at moment.
 53  
      * It is helpful specially when you have many nested elements, like a META
 54  
      * element with some multiline text.
 55  
      */
 56  
     private int currentIndentationLevel;
 57  
 
 58  
     private boolean currentlyInYaml;
 59  
 
 60  
     private boolean currentlyInSubtest;
 61  
 
 62  4
     private StringBuilder diagnosticBuffer = new StringBuilder();
 63  
 
 64  
     private TestSet testSet;
 65  
 
 66  
     public Memento() {
 67  4
         super();
 68  4
     }
 69  
 
 70  
     /**
 71  
      * @return if is first line
 72  
      */
 73  
     public boolean isFirstLine() {
 74  4
         return firstLine;
 75  
     }
 76  
 
 77  
     /**
 78  
      * @param is first line value
 79  
      */
 80  
     public void setFirstLine(boolean firstLine) {
 81  4
         this.firstLine = firstLine;
 82  4
     }
 83  
 
 84  
     /**
 85  
      * @return the planBeforeTestResult
 86  
      */
 87  
     public boolean isPlanBeforeTestResult() {
 88  4
         return planBeforeTestResult;
 89  
     }
 90  
 
 91  
     /**
 92  
      * @param planBeforeTestResult the planBeforeTestResult to set
 93  
      */
 94  
     public void setPlanBeforeTestResult(boolean planBeforeTestResult) {
 95  4
         this.planBeforeTestResult = planBeforeTestResult;
 96  4
     }
 97  
 
 98  
     /**
 99  
      * @return the lastLine
 100  
      */
 101  
     public String getLastLine() {
 102  0
         return lastLine;
 103  
     }
 104  
 
 105  
     /**
 106  
      * @param lastLine the lastLine to set
 107  
      */
 108  
     public void setLastLine(String lastLine) {
 109  0
         this.lastLine = lastLine;
 110  0
     }
 111  
 
 112  
     /**
 113  
      * @return the lastParsedElement
 114  
      */
 115  
     public TapElement getLastParsedElement() {
 116  4
         return lastParsedElement;
 117  
     }
 118  
 
 119  
     /**
 120  
      * @param lastParsedElement the lastParsedElement to set
 121  
      */
 122  
     public void setLastParsedElement(TapElement lastParsedElement) {
 123  4
         this.lastParsedElement = lastParsedElement;
 124  4
     }
 125  
 
 126  
     /**
 127  
      * @return the baseIndentationLevel
 128  
      */
 129  
     public int getBaseIndentationLevel() {
 130  4
         return baseIndentationLevel;
 131  
     }
 132  
 
 133  
     /**
 134  
      * @param baseIndentationLevel the baseIndentationLevel to set
 135  
      */
 136  
     public void setBaseIndentationLevel(int baseIndentationLevel) {
 137  4
         this.baseIndentationLevel = baseIndentationLevel;
 138  4
     }
 139  
 
 140  
     /**
 141  
      * @return the currentIndentationLevel
 142  
      */
 143  
     public int getCurrentIndentationLevel() {
 144  4
         return currentIndentationLevel;
 145  
     }
 146  
 
 147  
     /**
 148  
      * @param currentIndentationLevel the currentIndentationLevel to set
 149  
      */
 150  
     public void setCurrentIndentationLevel(int currentIndentationLevel) {
 151  4
         this.currentIndentationLevel = currentIndentationLevel;
 152  4
     }
 153  
 
 154  
     /**
 155  
      * @return the currentlyInYaml
 156  
      */
 157  
     public boolean isCurrentlyInYaml() {
 158  4
         return currentlyInYaml;
 159  
     }
 160  
 
 161  
     /**
 162  
      * @param currentlyInYaml the currentlyInYaml to set
 163  
      */
 164  
     public void setCurrentlyInYaml(boolean currentlyInYaml) {
 165  4
         this.currentlyInYaml = currentlyInYaml;
 166  4
     }
 167  
 
 168  
     /**
 169  
      * @return the currentlyInSubtest
 170  
      */
 171  
     public boolean isCurrentlyInSubtest() {
 172  0
         return currentlyInSubtest;
 173  
     }
 174  
 
 175  
     /**
 176  
      * @param currentlyInSubtest the currentlyInSubtest to set
 177  
      */
 178  
     public void setCurrentlyInSubtest(boolean currentlyInSubtest) {
 179  0
         this.currentlyInSubtest = currentlyInSubtest;
 180  0
     }
 181  
 
 182  
     /**
 183  
      * @return the diagnosticBuffer
 184  
      */
 185  
     public StringBuilder getDiagnosticBuffer() {
 186  4
         return diagnosticBuffer;
 187  
     }
 188  
 
 189  
     /**
 190  
      * @param diagnosticBuffer the diagnosticBuffer to set
 191  
      */
 192  
     public void setDiagnosticBuffer(StringBuilder diagnosticBuffer) {
 193  4
         this.diagnosticBuffer = diagnosticBuffer;
 194  4
     }
 195  
 
 196  
     /**
 197  
      * @return the testSet
 198  
      */
 199  
     public TestSet getTestSet() {
 200  4
         return testSet;
 201  
     }
 202  
 
 203  
     /**
 204  
      * @param testSet the testSet to set
 205  
      */
 206  
     public void setTestSet(TestSet testSet) {
 207  4
         this.testSet = testSet;
 208  4
     }
 209  
 
 210  
 }