示例#1
0
  public void writeCoverageInfoIfLineStartsANewFieldDeclaration(FileParser fileParser) {
    if (classAndFieldNames != null && className.equals(fileParser.getCurrentlyPendingClass())) {
      LineElement initialLineElement = fileParser.lineParser.getInitialElement();
      LineElement elementWithFieldName = initialLineElement.findWord(fieldName);

      if (elementWithFieldName != null) {
        buildOpeningTagForFieldWrapper();
        elementWithFieldName.wrapText(openingTag.toString(), "</span>");
        moveToNextField();
      }
    }
  }
示例#2
0
  private void buildOpeningTagForFieldWrapper() {
    openingTag.setLength(0);
    openingTag.append("<span class='");

    StaticFieldData staticData = coverageInfo.getStaticFieldData(classAndFieldNames);
    boolean staticField = staticData != null;
    openingTag.append(staticField ? "static" : "instance");

    openingTag.append(coverageInfo.isCovered(classAndFieldNames) ? " covered" : " uncovered");

    InstanceFieldData instanceData = coverageInfo.getInstanceFieldData(classAndFieldNames);

    if (staticField || instanceData != null) {
      openingTag.append("' title='");
      appendAccessCounts(staticField ? staticData : instanceData);
    }

    openingTag.append("'>");
  }
示例#3
0
 private void appendAccessCounts(FieldData fieldData) {
   openingTag.append("Reads: ").append(fieldData.getReadCount());
   openingTag.append(" Writes: ").append(fieldData.getWriteCount());
 }