Skip to content
Advertisement

Tag: sonarqube

junit- sonarQube test coverage : if condition

can you help me how I can cover if statement by junit test in this method: This is my Method in the controller “User” : My problem is with the 2 lines of the if statment, I don’t know how i want to cover them. This is my test code for this method : Thank you in advance for your

Using SonarQube how would one implement a java import blacklist?

Using SonarQube (version 3.0) I am trying to implement a blacklist of java libraries. For example I’d like for SonarQube to generate a code smell for any java file that contains an import for org.apache.lang.StringUtils I did find this rule: “Track uses of disallowed dependencies” however as previously stated I want to focus on the java file import statements themselves.

How to group cases in a switch statment? [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 1 year ago. Improve this question I currently have 31 cases in my Java switch statement. Originally, there were 30 and I have now added one more.

Sonar: Possible null pointer dereference due to return value of called method

I am getting issue from Sonar: “Style – Possible null pointer dereference due to return value of called method. findbugs:NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE. the issue is on lockUntil.after(new Date()); I’ve tried to change this issue line with or But it introduces other issues. Can anyone please guide? Answer Assuming that new Date() will never return null should be a valid assumption. My guess

Checkmarx – How to validate and sanitize HttpServletRequest .getInputStream to pass checkmarx scan

Following are checkmarx issue details Unrestricted File Upload Source Object : req (Line No – 39) target Object : getInputStream (Line No -41) request objects get highlighted in checkmarx tool – How do I properly validate, filter, escape, and/or encode user-controllable input to pass a Checkmarx scan? Answer This worked for me – checkmarx pass this high vulnerability I used

Advertisement