First of all, the bag required by JUnit, there is not much to say. Write a class: package us;
Import java.util. *;
public class SayHello {public SayHello () {} // test functions public String [] split1 (String str, String delim) {StringTokenizer st = new StringTokenizer (str, delim); int length = st.countTokens (); String [] Result = new string [length]; for (int i = 0; i While ((Index = Str.Indexof (Delim, POS))! = 1) {list.add (Str.Substring (POS, INDEX)); POS = Index Delimlength;} list.add (Str.Substring (POS) Return (String []) list.toArray ((new string [0]))))))));} // end split1} / ****************************** ************************** ////////> is the test class: package untricled9; Import junit.framework. *; Public Class Testsayhello Extends Testcase {Private SayHello Sayello = NULL; Protected void setup () THROWS Exception {Super.Setup (); SayHello = New Sayello (); Protected void teardown () throws exception {selfhel = null; super.teardown (); // Single test function public void testsplit () {Sayello shello = new sayhello (); string str = "a, b, c"; string delim = ","; String [] ActualReturn = shello.split1 (STR, DELIM);