Commit 8835bb9f302ee2238e9ede3f4911845c7b0a9c93
1 parent
aacdb6c9
Exists in
master
Refatoração da classe ContextsTest
Showing
1 changed file
with
16 additions
and
1 deletions
Show diff stats
impl/core/src/test/java/br/gov/frameworkdemoiselle/internal/context/ContextsTest.java
@@ -37,14 +37,18 @@ | @@ -37,14 +37,18 @@ | ||
37 | package br.gov.frameworkdemoiselle.internal.context; | 37 | package br.gov.frameworkdemoiselle.internal.context; |
38 | 38 | ||
39 | import static org.easymock.EasyMock.createMock; | 39 | import static org.easymock.EasyMock.createMock; |
40 | +import static org.easymock.EasyMock.expect; | ||
40 | import static org.easymock.EasyMock.expectLastCall; | 41 | import static org.easymock.EasyMock.expectLastCall; |
41 | -import static org.easymock.EasyMock.replay; | 42 | +//import static org.easymock.EasyMock.replay; |
43 | +import static org.powermock.api.easymock.PowerMock.mockStatic; | ||
44 | +import static org.powermock.api.easymock.PowerMock.replay; | ||
42 | import static org.junit.Assert.assertEquals; | 45 | import static org.junit.Assert.assertEquals; |
43 | import static org.junit.Assert.assertFalse; | 46 | import static org.junit.Assert.assertFalse; |
44 | import static org.junit.Assert.assertTrue; | 47 | import static org.junit.Assert.assertTrue; |
45 | 48 | ||
46 | import java.util.ArrayList; | 49 | import java.util.ArrayList; |
47 | import java.util.List; | 50 | import java.util.List; |
51 | +import java.util.Locale; | ||
48 | 52 | ||
49 | import javax.enterprise.context.ApplicationScoped; | 53 | import javax.enterprise.context.ApplicationScoped; |
50 | import javax.enterprise.context.RequestScoped; | 54 | import javax.enterprise.context.RequestScoped; |
@@ -53,9 +57,15 @@ import javax.enterprise.inject.spi.AfterBeanDiscovery; | @@ -53,9 +57,15 @@ import javax.enterprise.inject.spi.AfterBeanDiscovery; | ||
53 | 57 | ||
54 | import org.junit.Before; | 58 | import org.junit.Before; |
55 | import org.junit.Test; | 59 | import org.junit.Test; |
60 | +import org.junit.runner.RunWith; | ||
61 | +import org.powermock.core.classloader.annotations.PrepareForTest; | ||
62 | +import org.powermock.modules.junit4.PowerMockRunner; | ||
56 | 63 | ||
57 | import br.gov.frameworkdemoiselle.annotation.ViewScoped; | 64 | import br.gov.frameworkdemoiselle.annotation.ViewScoped; |
65 | +import br.gov.frameworkdemoiselle.util.Beans; | ||
58 | 66 | ||
67 | +@RunWith(PowerMockRunner.class) | ||
68 | +@PrepareForTest(Beans.class) | ||
59 | public class ContextsTest { | 69 | public class ContextsTest { |
60 | 70 | ||
61 | private AfterBeanDiscovery event; | 71 | private AfterBeanDiscovery event; |
@@ -63,6 +73,11 @@ public class ContextsTest { | @@ -63,6 +73,11 @@ public class ContextsTest { | ||
63 | @Before | 73 | @Before |
64 | public void setUp() throws Exception { | 74 | public void setUp() throws Exception { |
65 | Contexts.clear(); | 75 | Contexts.clear(); |
76 | + mockStatic(Beans.class); | ||
77 | + | ||
78 | + expect(Beans.getReference(Locale.class)).andReturn(Locale.getDefault()); | ||
79 | + | ||
80 | + replay(Beans.class); | ||
66 | } | 81 | } |
67 | 82 | ||
68 | @Test | 83 | @Test |