@Test public void testToXmlString() throws FileNotFoundException, URISyntaxException { final Violation infoViolation = new Violation( ViolationPosition.create( BEGINNING_LINE, ENDING_LINE, BEGINNING_COLUMN, ENDING_COLUMN ), INFO_RULE, null ); assertEquals( "As3 file at a root level", " <violation beginline=\"" + BEGINNING_LINE + "\" endline=\"" + ENDING_LINE + "\" begincolumn=\"" + BEGINNING_COLUMN + "\" endcolumn=\"" + ENDING_COLUMN + "\" rule=\"" + INFO_RULE.getRuleName() + "\" ruleset=\"" + RULE_SET_NAME + "\" package=\"" + abstractRowData.getPackageName() + "\" class=\"" + abstractRowData.getClassName() + "\" externalInfoUrl=\"" + Violation.RULESET_CREATOR_URL + "EmptyRule\" " + "priority=\"" + INFO_RULE.getPriority() + "\">" + "emptyMessage" + "</violation>" + infoViolation.getNewLine(), infoViolation.toXmlString( abstractRowData, RULE_SET_NAME ) ); final Violation warningViolation = new Violation( ViolationPosition.create( BEGINNING_LINE, ENDING_LINE, BEGINNING_COLUMN, ENDING_COLUMN ), WARNING_RULE, null ); assertEquals( "As3 File at a not-root level", " <violation beginline=\"" + BEGINNING_LINE + "\" endline=\"" + ENDING_LINE + "\" begincolumn=\"" + BEGINNING_COLUMN + "\" endcolumn=\"" + ENDING_COLUMN + "\" rule=\"" + WARNING_RULE.getRuleName() + "\" ruleset=\"" + RULE_SET_NAME + "\" package=\"" + abstractRowDataWithPackage.getPackageName() + "\" class=\"" + abstractRowData.getClassName() + "\" externalInfoUrl=\"" + Violation.RULESET_CREATOR_URL + "WarningRule\" " + "priority=\"" + WARNING_RULE.getPriority() + "\">" + "warning message" + "</violation>" + warningViolation.getNewLine(), warningViolation.toXmlString( abstractRowDataWithPackage, RULE_SET_NAME ) ); assertEquals( "Mxml File at a not-root level", " <violation beginline=\"" + BEGINNING_LINE + "\" endline=\"" + ENDING_LINE + "\" begincolumn=\"" + BEGINNING_COLUMN + "\" endcolumn=\"" + ENDING_COLUMN + "\" rule=\"" + WARNING_RULE.getRuleName() + "\" ruleset=\"" + RULE_SET_NAME + "\" package=\"" + iterationsListMxml.getPackageName() + "\" class=\"" + iterationsListMxml.getClassName() + "\" externalInfoUrl=\"" + Violation.RULESET_CREATOR_URL + "WarningRule\" " + "priority=\"" + WARNING_RULE.getPriority() + "\">" + "warning message" + "</violation>" + warningViolation.getNewLine(), warningViolation.toXmlString( iterationsListMxml, RULE_SET_NAME ) ); }
public String toXmlString( final IFlexFile violatedFile, final String ruleSetName ) { final Formatter formatter = new Formatter(); if ( rule != null ) { final StringBuffer message = new StringBuffer( getRuleMessage() ); formatter.format( " <violation beginline=\"%d\" " + "endline=\"%d\" begincolumn=\"%d\" " + "endcolumn=\"%d\" rule=\"%s\" " + "ruleset=\"%s\" package=\"%s\" " + "class=\"%s\" externalInfoUrl=\"%s\" " + "priority=\"%s\">%s</violation>" + getNewLine(), beginLine, endLine, beginColumn, endColumn, rule.getRuleName(), ruleSetName, violatedFile.getPackageName(), violatedFile.getClassName(), RULESET_CREATOR_URL + extractShortName( rule.getName() ), rule.getPriority(), message ); } return formatter.toString(); }
Violation implements IFlexViolation { public String toXmlString( final IFlexFile violatedFile, final String ruleSetName ) { final Formatter formatter = new Formatter(); if ( rule != null ) { final StringBuffer message = new StringBuffer( getRuleMessage() ); formatter.format( " <violation beginline=\"%d\" " + "endline=\"%d\" begincolumn=\"%d\" " + "endcolumn=\"%d\" rule=\"%s\" " + "ruleset=\"%s\" package=\"%s\" " + "class=\"%s\" externalInfoUrl=\"%s\" " + "priority=\"%s\">%s</violation>" + getNewLine(), beginLine, endLine, beginColumn, endColumn, rule.getRuleName(), ruleSetName, violatedFile.getPackageName(), violatedFile.getClassName(), RULESET_CREATOR_URL + extractShortName( rule.getName() ), rule.getPriority(), message ); } return formatter.toString(); } }
Violation implements IFlexViolation { public String toXmlString( final IFlexFile violatedFile, final String ruleSetName ) { final Formatter formatter = new Formatter(); if ( rule != null ) { final StringBuffer message = new StringBuffer( getRuleMessage() ); formatter.format( " <violation beginline=\"%d\" " + "endline=\"%d\" begincolumn=\"%d\" " + "endcolumn=\"%d\" rule=\"%s\" " + "ruleset=\"%s\" package=\"%s\" " + "class=\"%s\" externalInfoUrl=\"%s\" " + "priority=\"%s\">%s</violation>" + getNewLine(), beginLine, endLine, beginColumn, endColumn, rule.getRuleName(), ruleSetName, violatedFile.getPackageName(), violatedFile.getClassName(), RULESET_CREATOR_URL + extractShortName( rule.getName() ), rule.getPriority(), message ); } return formatter.toString(); } Violation( final ViolationPosition position,
                     final IFlexRule violatedRule,
                     final IFlexFile violatedFile ); }
Violation implements IFlexViolation { public String toXmlString( final IFlexFile violatedFile, final String ruleSetName ) { final Formatter formatter = new Formatter(); if ( rule != null ) { final StringBuffer message = new StringBuffer( getRuleMessage() ); formatter.format( " <violation beginline=\"%d\" " + "endline=\"%d\" begincolumn=\"%d\" " + "endcolumn=\"%d\" rule=\"%s\" " + "ruleset=\"%s\" package=\"%s\" " + "class=\"%s\" externalInfoUrl=\"%s\" " + "priority=\"%s\">%s</violation>" + getNewLine(), beginLine, endLine, beginColumn, endColumn, rule.getRuleName(), ruleSetName, violatedFile.getPackageName(), violatedFile.getClassName(), RULESET_CREATOR_URL + extractShortName( rule.getName() ), rule.getPriority(), message ); } return formatter.toString(); } Violation( final ViolationPosition position,
                     final IFlexRule violatedRule,
                     final IFlexFile violatedFile ); void appendToMessage( final String messageToAppend ); int compareTo( final IFlexViolation otherViolation ); int getBeginColumn(); int getBeginLine(); String getClassName(); String getDescription(); int getEndColumn(); int getEndLine(); String getFilename(); String getMethodName(); String getPackageName(); IFlexRule getRule(); String getRuleMessage(); String getVariableName(); boolean isSuppressed(); void replacePlaceholderInMessage( final String replacement,
                                            final int index ); void setEndColumn( final int column ); String toXmlString( final IFlexFile violatedFile,
                              final String ruleSetName ); }
Violation implements IFlexViolation { public String toXmlString( final IFlexFile violatedFile, final String ruleSetName ) { final Formatter formatter = new Formatter(); if ( rule != null ) { final StringBuffer message = new StringBuffer( getRuleMessage() ); formatter.format( " <violation beginline=\"%d\" " + "endline=\"%d\" begincolumn=\"%d\" " + "endcolumn=\"%d\" rule=\"%s\" " + "ruleset=\"%s\" package=\"%s\" " + "class=\"%s\" externalInfoUrl=\"%s\" " + "priority=\"%s\">%s</violation>" + getNewLine(), beginLine, endLine, beginColumn, endColumn, rule.getRuleName(), ruleSetName, violatedFile.getPackageName(), violatedFile.getClassName(), RULESET_CREATOR_URL + extractShortName( rule.getName() ), rule.getPriority(), message ); } return formatter.toString(); } Violation( final ViolationPosition position,
                     final IFlexRule violatedRule,
                     final IFlexFile violatedFile ); void appendToMessage( final String messageToAppend ); int compareTo( final IFlexViolation otherViolation ); int getBeginColumn(); int getBeginLine(); String getClassName(); String getDescription(); int getEndColumn(); int getEndLine(); String getFilename(); String getMethodName(); String getPackageName(); IFlexRule getRule(); String getRuleMessage(); String getVariableName(); boolean isSuppressed(); void replacePlaceholderInMessage( final String replacement,
                                            final int index ); void setEndColumn( final int column ); String toXmlString( final IFlexFile violatedFile,
                              final String ruleSetName ); static final String RULESET_CREATOR_URL; }