Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
NameStorageBeanTest source code from my blog post, 'Automated Deployment to GlassFish Using Jenkins CI Server and Apache Ant':
package helloworld;
import javax.ejb.embeddable.EJBContainer;
import javax.naming.NamingException;
import org.junit.*;
import static org.junit.Assert.assertEquals;
* @author Gary A. Stafford
public class NameStorageBeanTest {
private NameStorageBean instance = null;
private EJBContainer container = null;
public NameStorageBeanTest() {
public static void setUpClass() throws Exception {
public static void tearDownClass() throws Exception {
public void setUp() throws NamingException {
container = javax.ejb.embeddable.EJBContainer.createEJBContainer();
instance = (NameStorageBean) container.getContext().
public void tearDown() {
* Test of getName method, of class NameStorageBean.
public void testGetName() throws Exception {
String expResult = "Test";
String result = instance.getName();
assertEquals(expResult, result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment