📄 personservicetest.java
字号:
package junit.test;
import java.util.List;
import javax.naming.InitialContext;
import org.junit.BeforeClass;
import org.junit.Test;
import ent.user.bean.Person;
import ent.user.service.*;
public class PersonServiceTest {
private static PersonService personService;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
try {
InitialContext ctx = new InitialContext();
personService = (PersonService) ctx
.lookup("PersonServiceBean/remote");
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void testSave() {
personService.save(new Person("桂家琪", "mencous", "1988305", "0723110018",
1, 5));
}
@Test
public void testUpdate() {
Person person = personService.getPerson(1);
personService.update(person);
}
@Test
public void testDelete() {
personService.delete(1);
}
@Test
public void testGetPerson() {
Person person = personService.getPerson(1);
System.out.println(person.getPassword());
}
@Test
public void testGetPersons() {
List<Person> persons = personService.getPersons("mencouse", "1988305");
System.out.println(persons.isEmpty());
}
@Test
public void testGetUserName() {
List<Person> persons = personService.getUserName("mencouse");
System.out.println(persons.isEmpty());
}
@Test
public void testGetClasses() {
List<Person> persons = personService.getClasses(5);
System.out.println(persons.isEmpty());
}
@Test
public void testGetPurview() {
List<Person> persons = personService.getPurview(0);
System.out.println(persons.isEmpty());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -