title: JUnit test a static void method
body: <p>So I created a log function so I can see the date of every action. I now want to unittest them. Because the function uses a void, I can't test the output. </p>
  
  <p>I might change the void to a String, but then the point of using it as a void would be gone!</p>
  
  <p>What are my options?</p>
  
  <pre><code>public class Logger {
  
      public static void log(String s) {
          Date d = new Date();
          SimpleDateFormat ft =
                   new SimpleDateFormat ("yyyy.MM.dd '-' hh:mm:ss");
          System.out.println("[" + ft.format(d) + "]: " + s);
      }
  
  }
  </code></pre>
  
  <p>JUnit</p>
  
  <pre><code>@Test
  public void testLoggerEmptyString() {
      String s = "";
      log(s);
  }
  </code></pre>
  
  <p>Thanks :D</p>