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