Exemplo n.º 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();
      }
    }
  }
Exemplo n.º 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("'>");
  }
Exemplo n.º 3
0
 private void appendAccessCounts(FieldData fieldData) {
   openingTag.append("Reads: ").append(fieldData.getReadCount());
   openingTag.append(" Writes: ").append(fieldData.getWriteCount());
 }