aboutsummaryrefslogtreecommitdiff
path: root/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputValidSwitchIndent.java
blob: a239e4a976fa8cc48f77dfc0da201bd4e19cf4e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
package com.puppycrawl.tools.checkstyle.checks.indentation; //indent:0 exp:0

/**                                                                           //indent:0 exp:0
 * This test-input is intended to be checked using following configuration:   //indent:1 exp:1
 *                                                                            //indent:1 exp:1
 * arrayInitIndent = 4                                                        //indent:1 exp:1
 * basicOffset = 4                                                            //indent:1 exp:1
 * braceAdjustment = 0                                                        //indent:1 exp:1
 * caseIndent = 4                                                             //indent:1 exp:1
 * forceStrictCondition = false                                               //indent:1 exp:1
 * lineWrappingIndentation = 4                                                //indent:1 exp:1
 * tabWidth = 4                                                               //indent:1 exp:1
 * throwsIndent = 4                                                           //indent:1 exp:1
 *                                                                            //indent:1 exp:1
 * @author  jrichard                                                         //indent:1 exp:1
 */                                                                           //indent:1 exp:1
public class InputValidSwitchIndent { //indent:0 exp:0

    private static final int CONST = 5; //indent:4 exp:4
    private static final int CONST2 = 2; //indent:4 exp:4
    private static final int CONST3 = 3; //indent:4 exp:4

    /** Creates a new instance of InputValidSwitchIndent */ //indent:4 exp:4
    public InputValidSwitchIndent() { //indent:4 exp:4
    } //indent:4 exp:4

    private void method1() { //indent:4 exp:4
        int s = 3; //indent:8 exp:8

        switch (s) { //indent:8 exp:8

            case 4: //indent:12 exp:12
                System.identityHashCode(""); //indent:16 exp:16
                break; //indent:16 exp:16

            case CONST: //indent:12 exp:12
                break; //indent:16 exp:16

            case CONST2: //indent:12 exp:12
            case CONST3: //indent:12 exp:12
                break; //indent:16 exp:16

            default: //indent:12 exp:12
                System.identityHashCode(""); //indent:16 exp:16
                break; //indent:16 exp:16
        } //indent:8 exp:8


        // some people like to add curlies to their cases: //indent:8 exp:8
        switch (s) { //indent:8 exp:8

            case 4: { //indent:12 exp:12
                System.identityHashCode(""); //indent:16 exp:16
                break; //indent:16 exp:16
            } //indent:12 exp:12

            case CONST: //indent:12 exp:12
                break; //indent:16 exp:16

            case CONST2: //indent:12 exp:12
            case CONST3: //indent:12 exp:12
            { //indent:12 exp:12
                System.identityHashCode(""); //indent:16 exp:16
                break; //indent:16 exp:16
            } //indent:12 exp:12

            default: //indent:12 exp:12
                break; //indent:16 exp:16
        } //indent:8 exp:8

        // check broken 'case' lines //indent:8 exp:8
        switch (s) { //indent:8 exp:8

            case  //indent:12 exp:12
                4: { //indent:16 exp:16
                System.identityHashCode(""); //indent:16 exp:16
                break; //indent:16 exp:16
            } //indent:12 exp:12

            case  //indent:12 exp:12
                CONST: //indent:16 exp:16
                break; //indent:16 exp:16

            case CONST2: //indent:12 exp:12
            case  //indent:12 exp:12
                CONST3: //indent:16 exp:16
            { //indent:12 exp:12
                System.identityHashCode(""); //indent:16 exp:16
                break; //indent:16 exp:16
            } //indent:12 exp:12

            default: //indent:12 exp:12
                break; //indent:16 exp:16
        }         //indent:8 exp:8

        switch (s) { //indent:8 exp:8
        } //indent:8 exp:8


        switch (s) { //indent:8 exp:8
            default: //indent:12 exp:12
                System.identityHashCode(""); //indent:16 exp:16
                break; //indent:16 exp:16
        } //indent:8 exp:8

    } //indent:4 exp:4

} //indent:0 exp:0