Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Ignore
- public class BaseTest {
- public static EntityManagerFactory emf;
- public static EntityManager em;
- @BeforeClass
- public static void runBeforeClass() throws Exception {
- emf = Persistence.createEntityManagerFactory("test-hsqldb");
- em = emf.createEntityManager();
- }
- @AfterClass
- public static void runAfterClass() throws Exception {
- emf.close();
- }
- }
- public class UsersTest extends BaseTest {
- private static Logger log = Logger.getLogger(UsersTest.class);
- private static UserServiceBean slsb = new UserServiceBean();
- @Test
- public void getUsers() throws Exception {
- List<User> users = slsb.getUsers();
- Assert.assertTrue(users.size() > 0);
- }
- @BeforeClass
- public static void runBeforeClass() throws Exception {
- BaseTest.runBeforeClass();
- slsb.setEm(em);
- }
- @AfterClass
- public static void runAfterClass() throws Exception {
- BaseTest.runAfterClass();
- }
- }
Add Comment
Please, Sign In to add comment