package com.sm.web.person.service;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.sm.web.person.pojo.Person;
public class PersonServiceTest {
private static PersonService personService;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
try {
ApplicationContext applicationContext = new ClassPathXmlApplicationContext(
"com/sm/resources/spring/spring-core-basic.xml");
personService=(PersonService)applicationContext.getBean("personService");
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void add()
{
Person p=new Person();
p.setName("����");
p.setAge(25);
//p.setVersion(10);
personService.addPerson(p);
System.out.println("ok");
}
}