diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/metrics/xml/CyclomaticComplexity.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/metrics/xml/CyclomaticComplexity.xml
index 2747ddcab..e134bd68c 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/metrics/xml/CyclomaticComplexity.xml
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/metrics/xml/CyclomaticComplexity.xml
@@ -348,6 +348,95 @@
}
}
+ public void example1() {
+ if (a && b || b && d) {
+ if (y == z) {
+ x = 2;
+ } else if (y == t && !d) {
+ x = 2;
+ } else {
+ x = 2;
+ }
+ }
+ }
+
+ public void example2() {
+ if (c && d) {
+ while (z < y) {
+ x = 2;
+ }
+ }
+ }
+
+ public void example12() {
+ if (a && b || b && d) {
+ if (y == z) {
+ x = 2;
+ } else if (y == t && !d) {
+ x = 2;
+ } else {
+ x = 2;
+ }
+ }
+ }
+
+ public void example22() {
+ if (c && d) {
+ while (z < y) {
+ x = 2;
+ }
+ }
+ }
+
+ public void example3() {
+ if (a && !b) {
+ for (int n = 0; n < t; n++) {
+ x = 2;
+ }
+ }
+ }
+
+ public void example32() {
+ if (a && !b) {
+ for (int n = 0; n < t; n++) {
+ x = 2;
+ }
+ }
+ }
+
+ public void example4() {
+ switch (x) {
+ case 1:
+ x = 2;
+ break;
+
+ case 2:
+ case 3:
+ x = 2;
+ break;
+
+ default:
+ x = 2;
+ break;
+ }
+ }
+
+ public void example42() {
+ switch (x) {
+ case 1:
+ x = 2;
+ break;
+
+ case 2:
+ case 3:
+ x = 2;
+ break;
+
+ default:
+ x = 2;
+ break;
+ }
+ }
}
]]>
@@ -357,7 +446,7 @@
Test many unreported methods
1
- The class 'Complicated' has a total cyclomatic complexity of 40 (highest 8).
+ The class 'Complicated' has a total cyclomatic complexity of 80 (highest 8).