Reversing only vowels in a string
1) No more than one instruction per line.

if (string.length() == 0 || string.length() == 1) return string.toString();


i.e.:

if (string.length() == 0 || string.length() == 1) {
    return string.toString();
}
// or, better:
// if (string.length() &lt; 2) {
//     return string.toString();     
// }


2) Your main while feels strange, I don't like this creative use of postdecrement and greater then operator

while (numberOfTestCases --&gt; 0)  // BAD! See https://stackoverflow.com/questions/1642028/what-is-the-operator-in-c


In this case a for loop is better because you know the number of iterations.

3) while (true) is bad and force the developer to read all the code to understand how to break the loop

4) No need to pass a StringBuilder to reverseVowels: the method itself should create it.

5) Use temporary variables to improve readability:

...
for (int i = 0; i &lt; numberOfTestCases; i++) {
    String input = scanner.nextLine();

    String vowelsReversedString = reverseVowels(input);

    System.out.println("OUTPUT: " + vowelsReversedString);
}  
...

...
private static String reverseVowels(String string) {
    if (string == null || string.length() &lt; 2) {
        return string;
    }

    StringBuilder sb = new StringBuilder(string);

    int start = 0;
    int end = sb.length() - 1;

    while (start &lt; end) {
        ...
    }

    return sb.toString();
}
...