Package com.meritit; Import static Org.junit.Assert.AssertNull; Import static org.junit.Assert.AssertEquals; import org.junit.Test; Public class Testworddealutil { Test the WORDFORMAT4DB general handling situation @Test public void Wordformat4dbnormal () { String target = "EmployeeInfo"; String result = Worddealutil. wordformat4db (target); assertequals ("Employee_info", result); } Handling when testing for NULL @Test public void Wordformat4dbnull () { String target = null; String result = Worddealutil. wordformat4db (target); Assertnull (result); } Processing when testing an empty string @Test public void Wordformat4dbempty () { String target = ""; String result = Worddealutil. wordformat4db (target); assertequals ("", result); } To test the case when the first letter is capitalized @Test public void Wordformat4dbegin () { String target = "EmployeeInfo"; String result = Worddealutil. wordformat4db (target); assertequals ("Employee_info", result); } To test the case when the tail letter is capitalized @Test public void Wordformat4dbend () { String target = "Employeeinfoa"; String result = Worddealutil. wordformat4db (target); assertequals ("employee_info_a", result); } When you test multiple connected letters in uppercase @Test public void Wordformat4dbtogether () { String target = "Employeeainfo"; String result = Worddealutil. wordformat4db (target); assertequals ("Employee_a_info", result); } } |