title: JUnit test for void method (output-input dependency)
body: <p>I came up with a problem while trying to write a JUnit test for one specific method.
  I searched for possible solutions but many of them were not helpful as the output was not dependent on the input. Any help would be much appreciated.</p>
  <p>My class method looks like this:</p>
  <pre><code>public static void method1() {
      Scanner input = new Scanner(System.in);
      String state = input.nextLine();
      if( /* condition dependent on state value */ ) {
          System.out.println(&quot;...&quot;);
      } else {
          System.out.println(&quot;...&quot;+state+&quot;...&quot;);
      }
  }
  </code></pre>
  <p>How to write a JUnit test for it, can Robot class somehow solve the problem?</p>