I have a few methods in my class
public class StringChecking
{
public static void main(String[] args);
public void stringChecker(String text, int number); //takes a string and prints that out.
}
I want to write Unit test to test the 'stringChecker()
' method. I was wondering how I would go about doing that. When I create an object of type StringChecking
in my JUnit Testing class, I can't seem to access stringChecker()
method from that instance.
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.
JUnit test class
String expected = "My name is";
asserEquals(expected, actual);
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.