????????????????
????1)

????1??java??????

 

<span style="font-size:14px;">package com.medivh.app;
public class Person
{
public String sub(String username)
{
String sub = username.substring(3);
return sub;
}
public int add(int a??int b)
{
return a+b;
}
}</span>

????2??

 

<span style="font-size:14px;">package com.medivh.app;
import org.junit.Test;
import junit.framework.Assert;
import android.test.AndroidTestCase;
public class PersonTest extends AndroidTestCase
{
@Test
public void testSub() throws Exception
{
Person p = new Person();
p.sub(null);
}
public void testAdd() throws Exception
{
Person p = new Person();
int result = p.add(1?? 4);
Assert.assertEquals(result?? 6);
}
}
</span>