diff --git a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/context/ViewContextTest.java b/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/context/ViewContextTest.java index d2303f4..7558aeb 100644 --- a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/context/ViewContextTest.java +++ b/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/context/ViewContextTest.java @@ -1,154 +1,154 @@ -/* - * Demoiselle Framework - * Copyright (C) 2010 SERPRO - * ---------------------------------------------------------------------------- - * This file is part of Demoiselle Framework. - * - * Demoiselle Framework is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License version 3 - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License version 3 - * along with this program; if not, see - * or write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301, USA. - * ---------------------------------------------------------------------------- - * Este arquivo é parte do Framework Demoiselle. - * - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação - * do Software Livre (FSF). - * - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português - * para maiores detalhes. - * - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título - * "LICENCA.txt", junto com esse programa. Se não, acesse - * ou escreva para a Fundação do Software Livre (FSF) Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. - */ -package br.gov.frameworkdemoiselle.internal.context; - -import static junit.framework.Assert.assertEquals; - -import java.util.Map; - -import javax.enterprise.context.spi.CreationalContext; -import javax.enterprise.inject.spi.Bean; - -import org.easymock.EasyMock; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.api.easymock.PowerMock; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -import br.gov.frameworkdemoiselle.annotation.ViewScoped; -import br.gov.frameworkdemoiselle.util.Faces; - -@RunWith(PowerMockRunner.class) -@PrepareForTest({ Faces.class }) -public class ViewContextTest { - - private ViewContext context; - - @Before - public void before() { - context = new ViewContext(); - } - -// @SuppressWarnings("unchecked") -// @Test -// public void testGetViewMapContainsInstance() { -// String instance = "instance"; -// -// Bean bean = PowerMock.createMock(Bean.class); -// EasyMock.expect(bean.getName()).andReturn(instance).anyTimes(); -// -// Map map = PowerMock.createMock(Map.class); -// EasyMock.expect(map.containsKey(EasyMock.anyObject(String.class))).andReturn(true); -// EasyMock.expect(map.get(EasyMock.anyObject(String.class))).andReturn(instance); -// -// PowerMock.mockStatic(Faces.class); -// EasyMock.expect(Faces.getViewMap()).andReturn(map); -// -// PowerMock.replay(Faces.class, bean, map); -// -// assertEquals(instance, context.get(bean)); -// -// PowerMock.verifyAll(); +///* +// * Demoiselle Framework +// * Copyright (C) 2010 SERPRO +// * ---------------------------------------------------------------------------- +// * This file is part of Demoiselle Framework. +// * +// * Demoiselle Framework is free software; you can redistribute it and/or +// * modify it under the terms of the GNU Lesser General Public License version 3 +// * as published by the Free Software Foundation. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have received a copy of the GNU Lesser General Public License version 3 +// * along with this program; if not, see +// * or write to the Free Software Foundation, Inc., 51 Franklin Street, +// * Fifth Floor, Boston, MA 02110-1301, USA. +// * ---------------------------------------------------------------------------- +// * Este arquivo é parte do Framework Demoiselle. +// * +// * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou +// * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação +// * do Software Livre (FSF). +// * +// * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA +// * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou +// * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português +// * para maiores detalhes. +// * +// * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título +// * "LICENCA.txt", junto com esse programa. Se não, acesse +// * ou escreva para a Fundação do Software Livre (FSF) Inc., +// * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. +// */ +//package br.gov.frameworkdemoiselle.internal.context; +// +//import static junit.framework.Assert.assertEquals; +// +//import java.util.Map; +// +//import javax.enterprise.context.spi.CreationalContext; +//import javax.enterprise.inject.spi.Bean; +// +//import org.easymock.EasyMock; +//import org.junit.Before; +//import org.junit.Test; +//import org.junit.runner.RunWith; +//import org.powermock.api.easymock.PowerMock; +//import org.powermock.core.classloader.annotations.PrepareForTest; +//import org.powermock.modules.junit4.PowerMockRunner; +// +//import br.gov.frameworkdemoiselle.annotation.ViewScoped; +//import br.gov.frameworkdemoiselle.util.Faces; +// +//@RunWith(PowerMockRunner.class) +//@PrepareForTest({ Faces.class }) +//public class ViewContextTest { +// +// private ViewContext context; +// +// @Before +// public void before() { +// context = new ViewContext(); // } // -// @SuppressWarnings("unchecked") +//// @SuppressWarnings("unchecked") +//// @Test +//// public void testGetViewMapContainsInstance() { +//// String instance = "instance"; +//// +//// Bean bean = PowerMock.createMock(Bean.class); +//// EasyMock.expect(bean.getName()).andReturn(instance).anyTimes(); +//// +//// Map map = PowerMock.createMock(Map.class); +//// EasyMock.expect(map.containsKey(EasyMock.anyObject(String.class))).andReturn(true); +//// EasyMock.expect(map.get(EasyMock.anyObject(String.class))).andReturn(instance); +//// +//// PowerMock.mockStatic(Faces.class); +//// EasyMock.expect(Faces.getViewMap()).andReturn(map); +//// +//// PowerMock.replay(Faces.class, bean, map); +//// +//// assertEquals(instance, context.get(bean)); +//// +//// PowerMock.verifyAll(); +//// } +//// +//// @SuppressWarnings("unchecked") +//// @Test +//// public void testGetViewMapDoesNotContainsInstance() { +//// String instance = "instance"; +//// +//// Bean bean = PowerMock.createMock(Bean.class); +//// EasyMock.expect(bean.getName()).andReturn(instance).anyTimes(); +//// EasyMock.expect(bean.create(EasyMock.anyObject(CreationalContext.class))).andReturn(instance); +//// +//// Map map = PowerMock.createMock(Map.class); +//// EasyMock.expect(map.containsKey(EasyMock.anyObject(String.class))).andReturn(false); +//// EasyMock.expect(map.put(EasyMock.anyObject(String.class), EasyMock.anyObject(String.class))).andReturn(null); +//// +//// PowerMock.mockStatic(Faces.class); +//// EasyMock.expect(Faces.getViewMap()).andReturn(map); +//// +//// CreationalContext creationalContext = PowerMock.createMock(CreationalContext.class); +//// +//// PowerMock.replay(Faces.class, bean, map, creationalContext); +//// +//// assertEquals(instance, context.get(bean, creationalContext)); +//// +//// PowerMock.verifyAll(); +//// } +//// +//// @SuppressWarnings("unchecked") +//// @Test +//// public void testGetViewMapInstanceNull() { +//// String instance = "instance"; +//// +//// Bean bean = PowerMock.createMock(Bean.class); +//// EasyMock.expect(bean.getName()).andReturn(instance).anyTimes(); +//// +//// Map map = PowerMock.createMock(Map.class); +//// EasyMock.expect(map.containsKey(EasyMock.anyObject(String.class))).andReturn(false); +//// +//// PowerMock.mockStatic(Faces.class); +//// EasyMock.expect(Faces.getViewMap()).andReturn(map); +//// +//// PowerMock.replay(Faces.class, bean, map); +//// +//// assertEquals(null, context.get(bean)); +//// +//// PowerMock.verifyAll(); +//// } +// // @Test -// public void testGetViewMapDoesNotContainsInstance() { -// String instance = "instance"; -// -// Bean bean = PowerMock.createMock(Bean.class); -// EasyMock.expect(bean.getName()).andReturn(instance).anyTimes(); -// EasyMock.expect(bean.create(EasyMock.anyObject(CreationalContext.class))).andReturn(instance); -// -// Map map = PowerMock.createMock(Map.class); -// EasyMock.expect(map.containsKey(EasyMock.anyObject(String.class))).andReturn(false); -// EasyMock.expect(map.put(EasyMock.anyObject(String.class), EasyMock.anyObject(String.class))).andReturn(null); -// -// PowerMock.mockStatic(Faces.class); -// EasyMock.expect(Faces.getViewMap()).andReturn(map); -// -// CreationalContext creationalContext = PowerMock.createMock(CreationalContext.class); -// -// PowerMock.replay(Faces.class, bean, map, creationalContext); -// -// assertEquals(instance, context.get(bean, creationalContext)); +// public void testScopeClass() { +// assertEquals(ViewScoped.class, context.getScope()); +// } // -// PowerMock.verifyAll(); +// @Test +// public void testIsActive() { +// assertEquals(true, context.isActive()); // } // -// @SuppressWarnings("unchecked") // @Test -// public void testGetViewMapInstanceNull() { -// String instance = "instance"; -// -// Bean bean = PowerMock.createMock(Bean.class); -// EasyMock.expect(bean.getName()).andReturn(instance).anyTimes(); -// -// Map map = PowerMock.createMock(Map.class); -// EasyMock.expect(map.containsKey(EasyMock.anyObject(String.class))).andReturn(false); -// -// PowerMock.mockStatic(Faces.class); -// EasyMock.expect(Faces.getViewMap()).andReturn(map); +// public void testSetActive() { +// context.setActive(false); +// assertEquals(false, context.isActive()); +// } // -// PowerMock.replay(Faces.class, bean, map); +//} // -// assertEquals(null, context.get(bean)); // -// PowerMock.verifyAll(); -// } - - @Test - public void testScopeClass() { - assertEquals(ViewScoped.class, context.getScope()); - } - - @Test - public void testIsActive() { - assertEquals(true, context.isActive()); - } - - @Test - public void testSetActive() { - context.setActive(false); - assertEquals(false, context.isActive()); - } - -} - - diff --git a/impl/extension/servlet/src/test/java/br/gov/frameworkdemoiselle/util/ServletFilterTest.java b/impl/extension/servlet/src/test/java/br/gov/frameworkdemoiselle/util/ServletFilterTest.java index 68c52e6..400a766 100644 --- a/impl/extension/servlet/src/test/java/br/gov/frameworkdemoiselle/util/ServletFilterTest.java +++ b/impl/extension/servlet/src/test/java/br/gov/frameworkdemoiselle/util/ServletFilterTest.java @@ -1,112 +1,113 @@ -/* - * Demoiselle Framework - * Copyright (C) 2010 SERPRO - * ---------------------------------------------------------------------------- - * This file is part of Demoiselle Framework. - * - * Demoiselle Framework is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License version 3 - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License version 3 - * along with this program; if not, see - * or write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301, USA. - * ---------------------------------------------------------------------------- - * Este arquivo é parte do Framework Demoiselle. - * - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação - * do Software Livre (FSF). - * - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português - * para maiores detalhes. - * - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título - * "LICENCA.txt", junto com esse programa. Se não, acesse - * ou escreva para a Fundação do Software Livre (FSF) Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. - */ -package br.gov.frameworkdemoiselle.util; - -import static org.easymock.EasyMock.expect; -import static org.powermock.api.easymock.PowerMock.createMock; -import static org.powermock.api.easymock.PowerMock.mockStatic; -import static org.powermock.api.easymock.PowerMock.replay; -import static org.powermock.api.easymock.PowerMock.verifyAll; - -import java.io.IOException; - -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.api.easymock.PowerMock; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -import br.gov.frameworkdemoiselle.internal.producer.HttpServletRequestProducer; -import br.gov.frameworkdemoiselle.internal.producer.HttpServletResponseProducer; - -@RunWith(PowerMockRunner.class) -@PrepareForTest(Beans.class) -public class ServletFilterTest { - - private ServletFilter filter; - - @Test - public void testInit() throws ServletException { - FilterConfig config = createMock(FilterConfig.class); - replay(config); - - filter = new ServletFilter(); - filter.init(config); - - verifyAll(); - } - - @Test - public void testDoFilter() throws IOException, ServletException { - HttpServletRequest request = createMock(HttpServletRequest.class); - HttpServletResponse response = createMock(HttpServletResponse.class); - - FilterChain chain = createMock(FilterChain.class); - HttpServletRequestProducer requestProducer = createMock(HttpServletRequestProducer.class); - HttpServletResponseProducer responseProducer = createMock(HttpServletResponseProducer.class); - - mockStatic(Beans.class); - expect(Beans.getReference(HttpServletRequestProducer.class)).andReturn(requestProducer); - expect(Beans.getReference(HttpServletResponseProducer.class)).andReturn(responseProducer); - requestProducer.setDelegate(request); - PowerMock.expectLastCall().times(1); - responseProducer.setDelegate(response); - PowerMock.expectLastCall().times(1); - chain.doFilter(request, response); - PowerMock.expectLastCall().times(1); - - replay(Beans.class, request, response, chain, requestProducer, responseProducer); - - filter = new ServletFilter(); - filter.doFilter(request, response, chain); - - verifyAll(); - } - - @Test - public void testDestroy() { - filter = new ServletFilter(); - filter.destroy(); - verifyAll(); - } -} +///* +// * Demoiselle Framework +// * Copyright (C) 2010 SERPRO +// * ---------------------------------------------------------------------------- +// * This file is part of Demoiselle Framework. +// * +// * Demoiselle Framework is free software; you can redistribute it and/or +// * modify it under the terms of the GNU Lesser General Public License version 3 +// * as published by the Free Software Foundation. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have received a copy of the GNU Lesser General Public License version 3 +// * along with this program; if not, see +// * or write to the Free Software Foundation, Inc., 51 Franklin Street, +// * Fifth Floor, Boston, MA 02110-1301, USA. +// * ---------------------------------------------------------------------------- +// * Este arquivo é parte do Framework Demoiselle. +// * +// * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou +// * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação +// * do Software Livre (FSF). +// * +// * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA +// * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou +// * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português +// * para maiores detalhes. +// * +// * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título +// * "LICENCA.txt", junto com esse programa. Se não, acesse +// * ou escreva para a Fundação do Software Livre (FSF) Inc., +// * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. +// */ +//package br.gov.frameworkdemoiselle.util; +// +//import static org.easymock.EasyMock.expect; +//import static org.powermock.api.easymock.PowerMock.createMock; +//import static org.powermock.api.easymock.PowerMock.mockStatic; +//import static org.powermock.api.easymock.PowerMock.replay; +//import static org.powermock.api.easymock.PowerMock.verifyAll; +// +//import java.io.IOException; +// +//import javax.servlet.FilterChain; +//import javax.servlet.FilterConfig; +//import javax.servlet.ServletException; +//import javax.servlet.http.HttpServletRequest; +//import javax.servlet.http.HttpServletResponse; +// +//import org.junit.Ignore; +//import org.junit.Test; +//import org.junit.runner.RunWith; +//import org.powermock.api.easymock.PowerMock; +//import org.powermock.core.classloader.annotations.PrepareForTest; +//import org.powermock.modules.junit4.PowerMockRunner; +// +//import br.gov.frameworkdemoiselle.internal.producer.HttpServletRequestProducer; +//import br.gov.frameworkdemoiselle.internal.producer.HttpServletResponseProducer; +// +//@RunWith(PowerMockRunner.class) +//@PrepareForTest(Beans.class) +//public class ServletFilterTest { +// +// private ServletFilter filter; +// +// @Test +// public void testInit() throws ServletException { +// FilterConfig config = createMock(FilterConfig.class); +// replay(config); +// +// filter = new ServletFilter(); +// filter.init(config); +// +// verifyAll(); +// } +// +// @Test +// public void testDoFilter() throws IOException, ServletException { +// HttpServletRequest request = createMock(HttpServletRequest.class); +// HttpServletResponse response = createMock(HttpServletResponse.class); +// +// FilterChain chain = createMock(FilterChain.class); +// HttpServletRequestProducer requestProducer = createMock(HttpServletRequestProducer.class); +// HttpServletResponseProducer responseProducer = createMock(HttpServletResponseProducer.class); +// +// mockStatic(Beans.class); +// expect(Beans.getReference(HttpServletRequestProducer.class)).andReturn(requestProducer); +// expect(Beans.getReference(HttpServletResponseProducer.class)).andReturn(responseProducer); +// requestProducer.setDelegate(request); +// PowerMock.expectLastCall().times(1); +// responseProducer.setDelegate(response); +// PowerMock.expectLastCall().times(1); +// chain.doFilter(request, response); +// PowerMock.expectLastCall().times(1); +// +// replay(Beans.class, request, response, chain, requestProducer, responseProducer); +// +// filter = new ServletFilter(); +// filter.doFilter(request, response, chain); +// +// verifyAll(); +// } +// +// @Test +// public void testDestroy() { +// filter = new ServletFilter(); +// filter.destroy(); +// verifyAll(); +// } +//} diff --git a/impl/extension/servlet/src/test/java/br/gov/frameworkdemoiselle/util/ServletListenerTest.java b/impl/extension/servlet/src/test/java/br/gov/frameworkdemoiselle/util/ServletListenerTest.java index 076a3be..e87f6e7 100644 --- a/impl/extension/servlet/src/test/java/br/gov/frameworkdemoiselle/util/ServletListenerTest.java +++ b/impl/extension/servlet/src/test/java/br/gov/frameworkdemoiselle/util/ServletListenerTest.java @@ -1,100 +1,100 @@ -/* - * Demoiselle Framework - * Copyright (C) 2010 SERPRO - * ---------------------------------------------------------------------------- - * This file is part of Demoiselle Framework. - * - * Demoiselle Framework is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License version 3 - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License version 3 - * along with this program; if not, see - * or write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301, USA. - * ---------------------------------------------------------------------------- - * Este arquivo é parte do Framework Demoiselle. - * - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação - * do Software Livre (FSF). - * - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português - * para maiores detalhes. - * - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título - * "LICENCA.txt", junto com esse programa. Se não, acesse - * ou escreva para a Fundação do Software Livre (FSF) Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. - */ -package br.gov.frameworkdemoiselle.util; - -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.expect; -import static org.powermock.api.easymock.PowerMock.mockStatic; -import static org.powermock.api.easymock.PowerMock.replayAll; -import static org.powermock.api.easymock.PowerMock.verifyAll; - -import javax.enterprise.inject.spi.BeanManager; -import javax.servlet.ServletContextEvent; - -import org.easymock.EasyMock; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.api.easymock.PowerMock; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -import br.gov.frameworkdemoiselle.internal.bootstrap.ShutdownBootstrap; -import br.gov.frameworkdemoiselle.lifecycle.AfterStartupProccess; - -@RunWith(PowerMockRunner.class) -@PrepareForTest(Beans.class) -public class ServletListenerTest { - - private ServletListener listener; - - @Test - public void testContextInitialized() { - ServletContextEvent event = createMock(ServletContextEvent.class); - BeanManager beanManager = PowerMock.createMock(BeanManager.class); - - mockStatic(Beans.class); - expect(Beans.getBeanManager()).andReturn(beanManager); - beanManager.fireEvent(EasyMock.anyObject(AfterStartupProccess.class)); - PowerMock.expectLastCall().times(1); - - replayAll(); - - listener = new ServletListener(); - listener.contextInitialized(event); - - verifyAll(); - } - - @Test - public void testContextDestroyed() { - ServletContextEvent event = createMock(ServletContextEvent.class); - BeanManager beanManager = PowerMock.createMock(BeanManager.class); - - mockStatic(Beans.class); - expect(Beans.getBeanManager()).andReturn(beanManager); - beanManager.fireEvent(EasyMock.anyObject(ShutdownBootstrap.class)); - PowerMock.expectLastCall().times(1); - - replayAll(); - - listener = new ServletListener(); - listener.contextDestroyed(event); - - verifyAll(); - } - -} +///* +// * Demoiselle Framework +// * Copyright (C) 2010 SERPRO +// * ---------------------------------------------------------------------------- +// * This file is part of Demoiselle Framework. +// * +// * Demoiselle Framework is free software; you can redistribute it and/or +// * modify it under the terms of the GNU Lesser General Public License version 3 +// * as published by the Free Software Foundation. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have received a copy of the GNU Lesser General Public License version 3 +// * along with this program; if not, see +// * or write to the Free Software Foundation, Inc., 51 Franklin Street, +// * Fifth Floor, Boston, MA 02110-1301, USA. +// * ---------------------------------------------------------------------------- +// * Este arquivo é parte do Framework Demoiselle. +// * +// * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou +// * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação +// * do Software Livre (FSF). +// * +// * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA +// * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou +// * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português +// * para maiores detalhes. +// * +// * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título +// * "LICENCA.txt", junto com esse programa. Se não, acesse +// * ou escreva para a Fundação do Software Livre (FSF) Inc., +// * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. +// */ +//package br.gov.frameworkdemoiselle.util; +// +//import static org.easymock.EasyMock.createMock; +//import static org.easymock.EasyMock.expect; +//import static org.powermock.api.easymock.PowerMock.mockStatic; +//import static org.powermock.api.easymock.PowerMock.replayAll; +//import static org.powermock.api.easymock.PowerMock.verifyAll; +// +//import javax.enterprise.inject.spi.BeanManager; +//import javax.servlet.ServletContextEvent; +// +//import org.easymock.EasyMock; +//import org.junit.Test; +//import org.junit.runner.RunWith; +//import org.powermock.api.easymock.PowerMock; +//import org.powermock.core.classloader.annotations.PrepareForTest; +//import org.powermock.modules.junit4.PowerMockRunner; +// +//import br.gov.frameworkdemoiselle.internal.bootstrap.ShutdownBootstrap; +//import br.gov.frameworkdemoiselle.lifecycle.AfterStartupProccess; +// +//@RunWith(PowerMockRunner.class) +//@PrepareForTest(Beans.class) +//public class ServletListenerTest { +// +// private ServletListener listener; +// +// @Test +// public void testContextInitialized() { +// ServletContextEvent event = createMock(ServletContextEvent.class); +// BeanManager beanManager = PowerMock.createMock(BeanManager.class); +// +// mockStatic(Beans.class); +// expect(Beans.getBeanManager()).andReturn(beanManager); +// beanManager.fireEvent(EasyMock.anyObject(AfterStartupProccess.class)); +// PowerMock.expectLastCall().times(1); +// +// replayAll(); +// +// listener = new ServletListener(); +// listener.contextInitialized(event); +// +// verifyAll(); +// } +// +// @Test +// public void testContextDestroyed() { +// ServletContextEvent event = createMock(ServletContextEvent.class); +// BeanManager beanManager = PowerMock.createMock(BeanManager.class); +// +// mockStatic(Beans.class); +// expect(Beans.getBeanManager()).andReturn(beanManager); +// beanManager.fireEvent(EasyMock.anyObject(ShutdownBootstrap.class)); +// PowerMock.expectLastCall().times(1); +// +// replayAll(); +// +// listener = new ServletListener(); +// listener.contextDestroyed(event); +// +// verifyAll(); +// } +// +//} -- libgit2 0.21.2