package testForJunit;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import org.junit.Test;
import com.ai92.cooljunit.WorddealUtil;
public class TestWordDealUtil {
// 测试 wordFormat4DB 正常运行的情况
@Test public void wordFormat4DBNormal(){
String target = "employeeInfo";
String result = WorddealUtil.wordFormat4DB(target);
//チェック実行
assertEquals("employee_info", result);
}
// 测试 null 时的处理情况
@Test public void wordFormat4DBNull(){
String target = null;
String result = WorddealUtil.wordFormat4DB(target);
//チェック実行
assertNull(result);
}
// 测试空字符串的处理情况
@Test public void wordFormat4DBEmpty(){
String target = "";
String result = WorddealUtil.wordFormat4DB(target);
//チェック実行
assertEquals("", result);
}
// 测试当首字母大写时的情况
@Test public void wordFormat4DBegin(){
String target = "EmployeeInfo";
String result = WorddealUtil.wordFormat4DB(target);
//チェック実行
assertEquals("employee_info", result);
}
// 测试当尾字母为大写时的情况
@Test public void wordFormat4DBEnd(){
String target = "employeeInfoA";
String result = WorddealUtil.wordFormat4DB(target);
//チェック実行
assertEquals("employee_info_a", result);
}
// 测试多个相连字母大写时的情况
@Test public void wordFormat4DBTogether(){
String target = "employeeAInfo";
String result = WorddealUtil.wordFormat4DB(target);
//チェック実行
assertEquals("employee_a_info", result);
}
}
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import org.junit.Test;
import com.ai92.cooljunit.WorddealUtil;
public class TestWordDealUtil {
// 测试 wordFormat4DB 正常运行的情况
@Test public void wordFormat4DBNormal(){
String target = "employeeInfo";
String result = WorddealUtil.wordFormat4DB(target);
//チェック実行
assertEquals("employee_info", result);
}
// 测试 null 时的处理情况
@Test public void wordFormat4DBNull(){
String target = null;
String result = WorddealUtil.wordFormat4DB(target);
//チェック実行
assertNull(result);
}
// 测试空字符串的处理情况
@Test public void wordFormat4DBEmpty(){
String target = "";
String result = WorddealUtil.wordFormat4DB(target);
//チェック実行
assertEquals("", result);
}
// 测试当首字母大写时的情况
@Test public void wordFormat4DBegin(){
String target = "EmployeeInfo";
String result = WorddealUtil.wordFormat4DB(target);
//チェック実行
assertEquals("employee_info", result);
}
// 测试当尾字母为大写时的情况
@Test public void wordFormat4DBEnd(){
String target = "employeeInfoA";
String result = WorddealUtil.wordFormat4DB(target);
//チェック実行
assertEquals("employee_info_a", result);
}
// 测试多个相连字母大写时的情况
@Test public void wordFormat4DBTogether(){
String target = "employeeAInfo";
String result = WorddealUtil.wordFormat4DB(target);
//チェック実行
assertEquals("employee_a_info", result);
}
}