title: testing an input with junit
body: <p>So I developing this very simple game of TicTacToe. I want to test the method given below: </p>
  
  <pre><code>public class Board {
  
      private Scanner scan = new Scanner(System.in);
  
      public int inputBoardSize() {
          while (flag) {
              System.out.print("Enter the number of grids you want to play with:");
              try {
                  boardSize = Integer.parseInt(scan.next());
                  if (boardSize &lt; 3 || boardSize &gt; 10) {
                      System.out.println("Please choose a board size between 3 and 10");
                      continue;
                  }
                  flag = false;
                  break;
              } catch (NumberFormatException e) {
                  e.getMessage();
                  System.out.println("Please enter a number");
                  continue;
              }
  
          }
          printBoard(boardSize);
          return boardSize;
      }
  </code></pre>
  
  <p>But I am new to unit testing and need a little help. I am not able to figure out how to test two conditions </p>
  
  <ol>
  <li>the NumberFormatException</li>
  <li>When the input is not between 3 and 10. </li>
  </ol>
  
  <p>My testing class for the second condition is something like this:</p>
  
  <pre><code>public class BoardTest extends TestCase {
  
      @Test
      public void test() {
          Board board = new Board();
  
          String input = "2";
          InputStream in = new ByteArrayInputStream(input.getBytes());
          System.setIn(in);
  
      }
  }
  </code></pre>
  
  <p>I am not able to figure out what to do next.</p>