Java Code Examples for org.sonar.squidbridge.checks.CheckMessagesVerifier#next()

The following examples show how to use org.sonar.squidbridge.checks.CheckMessagesVerifier#next() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClassLengthCheckTest.java    From enforce-sonarqube-plugin with MIT License 5 votes vote down vote up
@Test
public void testErrorClassLength() throws Exception {
	classLengthCheck = new ClassLengthCheck();
    sourceFile = scanFile(new File("src/test/resources/checks/ClassLengthError.cls"), classLengthCheck);
    CheckMessagesVerifier chkMsgVerify = CheckMessagesVerifier.verify(sourceFile.getCheckMessages());
    //System.out.println("chkMsgVerify: "+ sourceFile.getCheckMessages());
    // For Class
    chkMsgVerify = chkMsgVerify.next();
    chkMsgVerify.atLine(2).withMessage("The maximum number of statements in class is: "+classLengthCheck.DEFAULT_CLASS_LENGTH+".");
    
}
 
Example 2
Source File: VariableCountCheckTest.java    From enforce-sonarqube-plugin with MIT License 5 votes vote down vote up
@Test
public void testErrorVariableCount() throws Exception {
	variableCountCheck = new VariableCountCheck();
    sourceFile = scanFile(new File("src/test/resources/checks/VariableCountCheckErrorClass.cls"), variableCountCheck);
    CheckMessagesVerifier chkMsgVerify = CheckMessagesVerifier.verify(sourceFile.getCheckMessages());
    
    chkMsgVerify = chkMsgVerify.next();
    chkMsgVerify.atLine(1).withMessage("Classes that have too many fields/variables can become unwieldy and could be redesigned to have fewer,possibly through grouping related fields/variables in new objects. The maximum number of fields/variables in class is: "+variableCountCheck.DEFAULT_VARIABLE_COUNT+".");
}
 
Example 3
Source File: ParameterCountCheckTest.java    From enforce-sonarqube-plugin with MIT License 5 votes vote down vote up
@Test
public void testErrorParameterCount() throws Exception {
	parameterCountCheck = new ParameterCountCheck();
    sourceFile = scanFile(new File("src/test/resources/checks/clazzError.cls"), parameterCountCheck);
    CheckMessagesVerifier chkMsgVerify = CheckMessagesVerifier.verify(sourceFile.getCheckMessages());
    
    // For Method
    chkMsgVerify = chkMsgVerify.next();
    chkMsgVerify.atLine(26).withMessage("The maximum number of parameters in method/constructor is: "+parameterCountCheck.DEFAULT_PARAM_COUNT+".");
    
    // For Constructor
    chkMsgVerify = chkMsgVerify.next();
    chkMsgVerify.atLine(30).withMessage("The maximum number of parameters in method/constructor is: "+parameterCountCheck.DEFAULT_PARAM_COUNT+".");
}