View Javadoc
1   package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks;
2   
3   import java.util.Scanner;
4   
5   /** Test input for GitHub issue #3090. https://github.com/checkstyle/checkstyle/issues/3090 . */
6   public class InputRightCurlyDoWhile {
7   
8     /** some javadoc. */
9     public void foo1() {
10      do {} while (true);
11    }
12  
13    /** some javadoc. */
14    public void foo2() {
15      int i = 1;
16      while (i < 5) {
17        String.CASE_INSENSITIVE_ORDER.equals(i + " ");
18        i++;
19      }
20    }
21  
22    /** some javadoc. */
23    public void foo3() {
24      int i = 1;
25      do {
26        i++;
27        String.CASE_INSENSITIVE_ORDER.equals(i + " ");
28      } while (i < 5);
29    }
30  
31    /** some javadoc. */
32    public void foo4() {
33      int prog;
34      int user;
35      prog = (int) (Math.random() * 10) + 1;
36      Scanner input = new Scanner(System.in, "utf-8");
37      if (input.hasNextInt()) {
38        do {
39          user = input.nextInt();
40          if (user == prog) {
41            String.CASE_INSENSITIVE_ORDER.equals("Good!");
42          } else {
43            if (user > 0 && user <= 10) {
44              String.CASE_INSENSITIVE_ORDER.equals("Bad! ");
45              if (prog < user) {
46                String.CASE_INSENSITIVE_ORDER.equals("My number is less than yours.");
47              } else {
48                String.CASE_INSENSITIVE_ORDER.equals("My number is greater than yours");
49              }
50            } else {
51              String.CASE_INSENSITIVE_ORDER.equals("Violation!");
52            }
53          }
54        } while (user != prog);
55      } else {
56        String.CASE_INSENSITIVE_ORDER.equals("Violation!");
57      }
58      String.CASE_INSENSITIVE_ORDER.equals("Goodbye!");
59    }
60  
61    /** some javadoc. */
62    public void foo5() {
63      do {} // violation ''}' at column 9 should be on the same line as the next part of .*'
64      while (true);
65    }
66  
67    /** some javadoc. */
68    public void foo6() {
69      do {} // violation ''}' at column 9 should be on the same line as the next part of .*'
70      while (true);
71    }
72  
73    /** some javadoc. */
74    public void foo7() {
75      do {} while (true);
76    }
77  
78    /** some javadoc. */
79    public void foo8() {
80      do {} // violation ''}' at column 9 should be on the same line as the next part of .*'
81      while (true);
82    }
83  
84    /** some javadoc. */
85    public void foo9() {
86      do {} while (true);
87    }
88  }