title: Writing a Unit test in Java with main method
body: <p>I have a few methods in my class</p>
  
  <pre><code>public class StringChecking
  {
  public static void main(String[] args);
  public void stringChecker(String text, int number); //takes a string and prints that out. 
  }
  </code></pre>
  
  <p>I want to write Unit test to test the '<code>stringChecker()</code>' method. I was wondering how I would go about doing that. When I create an object of type <code>StringChecking</code> in my JUnit Testing class, I can't seem to access <code>stringChecker()</code> method from that instance. </p>
  
  <p>StringChecker method prints out certain number of words of the text passed in depending on the parameter.I wish to check to see if the first 10 words getting printed out are same as the expected results.</p>
  
  <p>JUnit test class</p>
  
  <pre><code>String expected = "My name is";
  asserEquals(expected, actual);
  </code></pre>
  
  <p>I'm guessing I will have make my stringChecker method return something, inorder to do the check. But I don't understand why I can't access the method from testing class.  </p>