Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.acme.ejb;
- import javax.ejb.EJB;
- import javax.ejb.EJBContainer;
- import javax.ejb.Stateless;
- import org.junit.After;
- import org.junit.Assert;
- import org.junit.Before;
- import org.junit.Test;
- public class EJBContainerTestCase
- {
- private EJBContainer container;
- @Before
- public void create() throws Exception
- {
- container = EJBContainer.createEJBContainer();
- container.inject(this);
- }
- @After
- public void destroy() throws Exception
- {
- container.close();
- }
- @EJB
- private SimpleBean bean;
- @Test
- public void shouldBeAbleToInjectIntoTestClass() throws Exception
- {
- Assert.assertNotNull(bean);
- Assert.assertEquals("This should work", bean.getName());
- }
- @Stateless
- public static class SimpleBean
- {
- public String getName()
- {
- return "This should work";
- }
- }
- }
Add Comment
Please, Sign In to add comment