80,351
社区成员
发帖
与我相关
我的任务
分享
import junit.framework.Assert;
import android.test.AndroidTestCase;
import android.util.Log;
public class TestService extends AndroidTestCase
{
public void testAdd()
{
String str = "123$$456";
String[] infoStrings = str.split("$$");
Log.w("TestService", str + "=>" + Integer.toString(infoStrings.length));
Assert.assertEquals(infoStrings.length, 2);
/**
* 为什么这里返回的 infoStrings 为 1 不是 2 呢
*/
}
public void testAdd2()
{
String str = "123##456";
String[] infoStrings = str.split("##");
Log.w("TestService", str + "=>" + Integer.toString(infoStrings.length));
Assert.assertEquals(infoStrings.length, 2);
/**
* 这里返回的 infoStrings 为正确的 2
*/
}
}