Commit f0613a4022e18e2be28db9b4ce4d2570804ea0a1

Authored by Ednara Oliveira
1 parent 78c36c78
Exists in master

Retirada do @Ignore dos testes unitários

impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/context/ViewContextTest.java
... ... @@ -35,7 +35,7 @@
35 35 * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
36 36 */
37 37 package br.gov.frameworkdemoiselle.internal.context;
38   -import org.junit.Ignore;
  38 +
39 39 import static junit.framework.Assert.assertEquals;
40 40  
41 41 import java.util.Map;
... ... @@ -53,7 +53,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
53 53  
54 54 import br.gov.frameworkdemoiselle.annotation.ViewScoped;
55 55 import br.gov.frameworkdemoiselle.util.Faces;
56   -@Ignore
  56 +
57 57 @RunWith(PowerMockRunner.class)
58 58 @PrepareForTest({ Faces.class })
59 59 public class ViewContextTest {
... ... @@ -142,4 +142,13 @@ public class ViewContextTest {
142 142 public void testIsActive() {
143 143 assertEquals(true, context.isActive());
144 144 }
  145 +
  146 + @Test
  147 + public void testSetActive() {
  148 + context.setActive(false);
  149 + assertEquals(false, context.isActive());
  150 + }
  151 +
145 152 }
  153 +
  154 +
... ...
impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/ApplicationExceptionHandlerFactoryTest.java
... ... @@ -35,7 +35,7 @@
35 35 * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
36 36 */
37 37 package br.gov.frameworkdemoiselle.internal.implementation;
38   -import org.junit.Ignore;
  38 +
39 39 import static junit.framework.Assert.assertEquals;
40 40 import static org.easymock.EasyMock.expect;
41 41 import static org.powermock.api.easymock.PowerMock.replayAll;
... ... @@ -48,7 +48,7 @@ import org.junit.Test;
48 48 import org.junit.runner.RunWith;
49 49 import org.powermock.api.easymock.PowerMock;
50 50 import org.powermock.modules.junit4.PowerMockRunner;
51   -@Ignore
  51 +
52 52 @RunWith(PowerMockRunner.class)
53 53 public class ApplicationExceptionHandlerFactoryTest {
54 54  
... ...
impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/AuthenticationExceptionHandlerFactoryTest.java
... ... @@ -35,7 +35,7 @@
35 35 * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
36 36 */
37 37 package br.gov.frameworkdemoiselle.internal.implementation;
38   -import org.junit.Ignore;
  38 +
39 39 import static junit.framework.Assert.assertEquals;
40 40 import static org.easymock.EasyMock.expect;
41 41 import static org.powermock.api.easymock.PowerMock.replayAll;
... ... @@ -48,13 +48,13 @@ import org.junit.Test;
48 48 import org.junit.runner.RunWith;
49 49 import org.powermock.api.easymock.PowerMock;
50 50 import org.powermock.modules.junit4.PowerMockRunner;
51   -@Ignore
  51 +
52 52 @RunWith(PowerMockRunner.class)
53 53 public class AuthenticationExceptionHandlerFactoryTest {
54 54  
55 55 @Test
56 56 public void testGetExceptionHandler() {
57   -
  57 +
58 58 ExceptionHandler jsfExceptionHandler = PowerMock.createMock(ExceptionHandler.class);
59 59  
60 60 ExceptionHandlerFactory jsfFactory = PowerMock.createMock(ExceptionHandlerFactory.class);
... ... @@ -69,7 +69,7 @@ public class AuthenticationExceptionHandlerFactoryTest {
69 69 assertEquals(handler.getWrapped(), jsfExceptionHandler);
70 70  
71 71 verifyAll();
72   -
  72 +
73 73 }
74 74  
75 75 }
... ...
impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/AuthenticationExceptionHandlerTest.java
1   -///*
2   -// * Demoiselle Framework
3   -// * Copyright (C) 2010 SERPRO
4   -// * ----------------------------------------------------------------------------
5   -// * This file is part of Demoiselle Framework.
6   -// *
7   -// * Demoiselle Framework is free software; you can redistribute it and/or
8   -// * modify it under the terms of the GNU Lesser General Public License version 3
9   -// * as published by the Free Software Foundation.
10   -// *
11   -// * This program is distributed in the hope that it will be useful,
12   -// * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14   -// * GNU General Public License for more details.
15   -// *
16   -// * You should have received a copy of the GNU Lesser General Public License version 3
17   -// * along with this program; if not, see <http://www.gnu.org/licenses/>
18   -// * or write to the Free Software Foundation, Inc., 51 Franklin Street,
19   -// * Fifth Floor, Boston, MA 02110-1301, USA.
20   -// * ----------------------------------------------------------------------------
21   -// * Este arquivo é parte do Framework Demoiselle.
22   -// *
23   -// * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
24   -// * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
25   -// * do Software Livre (FSF).
26   -// *
27   -// * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
28   -// * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
29   -// * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
30   -// * para maiores detalhes.
31   -// *
32   -// * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
33   -// * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
34   -// * ou escreva para a Fundação do Software Livre (FSF) Inc.,
35   -// * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
36   -// */
37   -//package br.gov.frameworkdemoiselle.internal.implementation;
38   -//
39   -//import static junit.framework.Assert.assertFalse;
40   -//import static junit.framework.Assert.assertTrue;
41   -//import static org.easymock.EasyMock.expect;
42   -//import static org.powermock.api.easymock.PowerMock.createMock;
43   -//import static org.powermock.api.easymock.PowerMock.expectLastCall;
44   -//import static org.powermock.api.easymock.PowerMock.mockStatic;
45   -//import static org.powermock.api.easymock.PowerMock.replayAll;
46   -//import static org.powermock.api.easymock.PowerMock.verifyAll;
47   -//
48   -//import java.util.ArrayList;
49   -//import java.util.Collection;
50   -//
51   -//import javax.faces.context.ExceptionHandler;
52   -//import javax.faces.event.ExceptionQueuedEvent;
53   -//import javax.faces.event.ExceptionQueuedEventContext;
54   -//
55   -//import org.junit.Before;
56   -//import org.junit.Test;
57   -//import org.junit.runner.RunWith;
58   -//import org.powermock.core.classloader.annotations.PrepareForTest;
59   -//import org.powermock.modules.junit4.PowerMockRunner;
60   -//
61   -//import br.gov.frameworkdemoiselle.security.NotLoggedInException;
62   -//import br.gov.frameworkdemoiselle.util.Beans;
63   -//
64   -//@RunWith(PowerMockRunner.class)
65   -//@PrepareForTest({ Beans.class, CoreBundle.class })
66   -//public class AuthenticationExceptionHandlerTest {
67   -//
68   -// private AuthenticationExceptionHandler handler;
69   -//
70   -// private ExceptionQueuedEventContext eventContext;
71   -//
72   -// private Collection<ExceptionQueuedEvent> events;
73   -//
74   -// @Before
75   -// public void setUp() {
76   -//
77   -// mockStatic(Beans.class);
78   -//
79   -// events = new ArrayList<ExceptionQueuedEvent>();
80   -// ExceptionHandler jsfExceptionHandler = createMock(ExceptionHandler.class);
81   -// handler = new AuthenticationExceptionHandler(jsfExceptionHandler);
82   -// eventContext = createMock(ExceptionQueuedEventContext.class);
83   -// ExceptionQueuedEvent event = createMock(ExceptionQueuedEvent.class);
84   -//
85   -// expect(event.getSource()).andReturn(eventContext);
86   -// expect(handler.getUnhandledExceptionQueuedEvents()).andReturn(events).times(2);
87   -//
88   -// events.add(event);
89   -//
90   -// }
91   -//
92   -// @Test
93   -// public void testHandleNotLoggedInException() {
94   -//
95   -// NotLoggedInException exception = new NotLoggedInException("");
96   -//
97   -// SecurityObserver observer = createMock(SecurityObserver.class);
98   -// expect(Beans.getReference(SecurityObserver.class)).andReturn(observer);
99   -// expect(eventContext.getException()).andReturn(exception);
100   -//
101   -// observer.redirectToLoginPage();
102   -// expectLastCall();
103   -//
104   -// replayAll();
105   -//
106   -// handler.handle();
107   -//
108   -// assertTrue(events.isEmpty());
109   -//
110   -// verifyAll();
111   -//
112   -// }
113   -//
114   -// @Test
115   -// public void testHandleAnyException() {
116   -//
117   -// Exception exception = new Exception();
118   -//
119   -// expect(eventContext.getException()).andReturn(exception);
120   -//
121   -// handler.getWrapped().handle();
122   -// expectLastCall();
123   -//
124   -// replayAll();
125   -//
126   -// handler.handle();
127   -//
128   -// assertFalse(events.isEmpty());
129   -//
130   -// verifyAll();
131   -//
132   -// }
133   -//
134   -//}
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
  37 +package br.gov.frameworkdemoiselle.internal.implementation;
  38 +
  39 +import static junit.framework.Assert.assertFalse;
  40 +import static junit.framework.Assert.assertTrue;
  41 +import static org.easymock.EasyMock.expect;
  42 +import static org.powermock.api.easymock.PowerMock.createMock;
  43 +import static org.powermock.api.easymock.PowerMock.expectLastCall;
  44 +import static org.powermock.api.easymock.PowerMock.mockStatic;
  45 +import static org.powermock.api.easymock.PowerMock.replayAll;
  46 +import static org.powermock.api.easymock.PowerMock.verifyAll;
  47 +
  48 +import java.util.ArrayList;
  49 +import java.util.Collection;
  50 +
  51 +import javax.faces.context.ExceptionHandler;
  52 +import javax.faces.event.ExceptionQueuedEvent;
  53 +import javax.faces.event.ExceptionQueuedEventContext;
  54 +
  55 +import org.junit.Before;
  56 +import org.junit.Test;
  57 +import org.junit.runner.RunWith;
  58 +import org.powermock.core.classloader.annotations.PrepareForTest;
  59 +import org.powermock.modules.junit4.PowerMockRunner;
  60 +
  61 +import br.gov.frameworkdemoiselle.security.NotLoggedInException;
  62 +import br.gov.frameworkdemoiselle.util.Beans;
  63 +
  64 +@RunWith(PowerMockRunner.class)
  65 +@PrepareForTest({ Beans.class})
  66 +public class AuthenticationExceptionHandlerTest {
  67 +
  68 + private AuthenticationExceptionHandler handler;
  69 +
  70 + private ExceptionQueuedEventContext eventContext;
  71 +
  72 + private Collection<ExceptionQueuedEvent> events;
  73 +
  74 + @Before
  75 + public void setUp() {
  76 +
  77 + mockStatic(Beans.class);
  78 +
  79 + events = new ArrayList<ExceptionQueuedEvent>();
  80 + ExceptionHandler jsfExceptionHandler = createMock(ExceptionHandler.class);
  81 + handler = new AuthenticationExceptionHandler(jsfExceptionHandler);
  82 + eventContext = createMock(ExceptionQueuedEventContext.class);
  83 + ExceptionQueuedEvent event = createMock(ExceptionQueuedEvent.class);
  84 +
  85 + expect(event.getSource()).andReturn(eventContext);
  86 + expect(handler.getUnhandledExceptionQueuedEvents()).andReturn(events).times(2);
  87 +
  88 + events.add(event);
  89 +
  90 + }
  91 +
  92 + @Test
  93 + public void testHandleNotLoggedInException() {
  94 +
  95 + NotLoggedInException exception = new NotLoggedInException("");
  96 +
  97 + SecurityObserver observer = createMock(SecurityObserver.class);
  98 + expect(Beans.getReference(SecurityObserver.class)).andReturn(observer);
  99 + expect(eventContext.getException()).andReturn(exception);
  100 +
  101 + observer.redirectToLoginPage();
  102 + expectLastCall();
  103 +
  104 + replayAll();
  105 +
  106 + handler.handle();
  107 +
  108 + assertTrue(events.isEmpty());
  109 +
  110 + verifyAll();
  111 +
  112 + }
  113 +
  114 + @Test
  115 + public void testHandleAnyException() {
  116 +
  117 + Exception exception = new Exception();
  118 +
  119 + expect(eventContext.getException()).andReturn(exception);
  120 +
  121 + handler.getWrapped().handle();
  122 + expectLastCall();
  123 +
  124 + replayAll();
  125 +
  126 + handler.handle();
  127 +
  128 + assertFalse(events.isEmpty());
  129 +
  130 + verifyAll();
  131 +
  132 + }
  133 +
  134 +}
... ...
impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/AuthorizationExceptionHandlerFactoryTest.java
... ... @@ -48,7 +48,7 @@ import org.junit.Test;
48 48 import org.junit.runner.RunWith;
49 49 import org.powermock.api.easymock.PowerMock;
50 50 import org.powermock.modules.junit4.PowerMockRunner;
51   -@Ignore
  51 +
52 52 @RunWith(PowerMockRunner.class)
53 53 public class AuthorizationExceptionHandlerFactoryTest {
54 54  
... ...
impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/MessagePhaseListenerTest.java
... ... @@ -35,7 +35,7 @@
35 35 * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
36 36 */
37 37 package br.gov.frameworkdemoiselle.internal.implementation;
38   -import org.junit.Ignore;
  38 +
39 39 import static org.easymock.EasyMock.expect;
40 40 import static org.powermock.api.easymock.PowerMock.mockStatic;
41 41 import static org.powermock.api.easymock.PowerMock.replayAll;
... ... @@ -62,7 +62,7 @@ import br.gov.frameworkdemoiselle.message.Message;
62 62 import br.gov.frameworkdemoiselle.message.MessageContext;
63 63 import br.gov.frameworkdemoiselle.util.Beans;
64 64 import br.gov.frameworkdemoiselle.util.Faces;
65   -@Ignore
  65 +
66 66 @RunWith(PowerMockRunner.class)
67 67 @PrepareForTest({ LoggerProducer.class, Beans.class, Faces.class })
68 68 public class MessagePhaseListenerTest {
... ...
impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/RedirectExceptionHandlerFactoryTest.java
... ... @@ -35,7 +35,7 @@
35 35 * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
36 36 */
37 37 package br.gov.frameworkdemoiselle.internal.implementation;
38   -import org.junit.Ignore;
  38 +
39 39 import static junit.framework.Assert.assertEquals;
40 40 import static org.easymock.EasyMock.expect;
41 41 import static org.powermock.api.easymock.PowerMock.replayAll;
... ... @@ -48,13 +48,13 @@ import org.junit.Test;
48 48 import org.junit.runner.RunWith;
49 49 import org.powermock.api.easymock.PowerMock;
50 50 import org.powermock.modules.junit4.PowerMockRunner;
51   -@Ignore
  51 +
52 52 @RunWith(PowerMockRunner.class)
53 53 public class RedirectExceptionHandlerFactoryTest {
54 54  
55 55 @Test
56 56 public void testGetExceptionHandler() {
57   -
  57 +
58 58 ExceptionHandler jsfExceptionHandler = PowerMock.createMock(ExceptionHandler.class);
59 59  
60 60 ExceptionHandlerFactory jsfFactory = PowerMock.createMock(ExceptionHandlerFactory.class);
... ... @@ -69,7 +69,7 @@ public class RedirectExceptionHandlerFactoryTest {
69 69 assertEquals(handler.getWrapped(), jsfExceptionHandler);
70 70  
71 71 verifyAll();
72   -
  72 +
73 73 }
74 74  
75 75 }
... ...
impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/RedirectExceptionHandlerTest.java
... ... @@ -35,7 +35,7 @@
35 35 * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
36 36 */
37 37 package br.gov.frameworkdemoiselle.internal.implementation;
38   -import org.junit.Ignore;
  38 +
39 39 import static junit.framework.Assert.assertFalse;
40 40 import static junit.framework.Assert.assertTrue;
41 41 import static org.easymock.EasyMock.expect;
... ... @@ -57,7 +57,7 @@ import org.junit.runner.RunWith;
57 57 import org.powermock.modules.junit4.PowerMockRunner;
58 58  
59 59 import br.gov.frameworkdemoiselle.annotation.Redirect;
60   -@Ignore
  60 +
61 61 @RunWith(PowerMockRunner.class)
62 62 public class RedirectExceptionHandlerTest {
63 63  
... ... @@ -66,7 +66,7 @@ public class RedirectExceptionHandlerTest {
66 66 private ExceptionQueuedEventContext eventContext;
67 67  
68 68 private Collection<ExceptionQueuedEvent> events;
69   -
  69 +
70 70 @SuppressWarnings("serial")
71 71 @Redirect
72 72 class AnnotatedException extends RuntimeException {
... ... @@ -86,18 +86,18 @@ public class RedirectExceptionHandlerTest {
86 86 expect(handler.getUnhandledExceptionQueuedEvents()).andReturn(events).times(2);
87 87  
88 88 }
89   -
  89 +
90 90 @Test
91 91 public void testHandleAnAnnotatedException() {
92 92  
93 93 AnnotatedException exception = new AnnotatedException();
94   -
  94 +
95 95 expect(eventContext.getException()).andReturn(exception);
96   -
  96 +
97 97 replayAll();
98 98  
99 99 handler.handle();
100   -
  100 +
101 101 assertTrue(events.isEmpty());
102 102  
103 103 verifyAll();
... ... @@ -108,16 +108,16 @@ public class RedirectExceptionHandlerTest {
108 108 public void testHandleAnyException() {
109 109  
110 110 Exception exception = new Exception();
111   -
  111 +
112 112 expect(eventContext.getException()).andReturn(exception);
113   -
  113 +
114 114 handler.getWrapped().handle();
115 115 expectLastCall();
116   -
  116 +
117 117 replayAll();
118 118  
119 119 handler.handle();
120   -
  120 +
121 121 assertFalse(events.isEmpty());
122 122  
123 123 verifyAll();
... ...
impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/template/AbstractListPageBeanTest.java
... ... @@ -35,7 +35,7 @@
35 35 * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
36 36 */
37 37 package br.gov.frameworkdemoiselle.template;
38   -import org.junit.Ignore;
  38 +
39 39 import static org.easymock.EasyMock.expect;
40 40 import static org.junit.Assert.assertEquals;
41 41 import static org.junit.Assert.assertNull;
... ... @@ -62,7 +62,7 @@ import br.gov.frameworkdemoiselle.internal.implementation.PaginationImpl;
62 62 import br.gov.frameworkdemoiselle.pagination.Pagination;
63 63 import br.gov.frameworkdemoiselle.pagination.PaginationContext;
64 64 import br.gov.frameworkdemoiselle.util.Reflections;
65   -@Ignore
  65 +
66 66 @RunWith(PowerMockRunner.class)
67 67 @PrepareForTest({ Reflections.class, PaginationContext.class, Pagination.class })
68 68 public class AbstractListPageBeanTest {
... ...
impl/extension/jta/src/test/java/br/gov/frameworkdemoiselle/transaction/JTATransactionTest.java
1 1 package br.gov.frameworkdemoiselle.transaction;
2   -import org.junit.Ignore;
  2 +
3 3 import static org.easymock.EasyMock.createMock;
4 4 import static org.easymock.EasyMock.expect;
5 5 import static org.easymock.EasyMock.expectLastCall;
... ... @@ -25,7 +25,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
25 25 import org.powermock.modules.junit4.PowerMockRunner;
26 26  
27 27 import br.gov.frameworkdemoiselle.util.Beans;
28   -@Ignore
  28 +
29 29 @RunWith(PowerMockRunner.class)
30 30 @PrepareForTest({ Beans.class })
31 31 public class JTATransactionTest {
... ...
impl/extension/se/src/test/java/br/gov/frameworkdemoiselle/internal/producer/SeLocaleProducerTest.java
... ... @@ -5,7 +5,7 @@ import java.util.Locale;
5 5 import junit.framework.Assert;
6 6  
7 7 import org.junit.Test;
8   -@Ignore
  8 +
9 9 public class SeLocaleProducerTest {
10 10  
11 11 @Test
... ...