git://wamblee.org
/
utils
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
(no commit message)
[utils]
/
support
/
cdi
/
src
/
test
/
java
/
org
/
wamblee
/
cdi
/
CdiInjectorTest.java
diff --git
a/support/cdi/src/test/java/org/wamblee/cdi/CdiInjectorTest.java
b/support/cdi/src/test/java/org/wamblee/cdi/CdiInjectorTest.java
index 53d7df913176c607803afcb1f2d4b0b233c64b94..13946b3aeeee22efd714fc7f9b8d3e99861dfcc3 100644
(file)
--- a/
support/cdi/src/test/java/org/wamblee/cdi/CdiInjectorTest.java
+++ b/
support/cdi/src/test/java/org/wamblee/cdi/CdiInjectorTest.java
@@
-17,23
+17,51
@@
package org.wamblee.cdi;
import static junit.framework.Assert.*;
import static junit.framework.Assert.*;
+import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
import org.junit.Test;
+import org.wamblee.inject.InjectorBuilder;
-public class CdiInjectorTest {
+public class CdiInjectorTest
extends BaseTestFixture
{
-
- @Test
- public void testInject() {
- fail();
+ private BeanManagerSetup manager;
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ manager = new BeanManagerSetup();
+ manager.initialize();
}
}
-
+
+ @After
+ public void tearDown() throws Exception {
+ manager.shutdown();
+ super.tearDown();
+ }
+
@Test
@Test
- public void testWrongType() {
- fail();
+ public void testInject() {
+ CdiInjector injector = new CdiInjector(manager.getBeanManager(),
+ MyPojo.class);
+ MyPojo pojo = new MyPojo();
+ injector.inject(pojo);
+ assertNotNull(pojo.getSingleton());
}
}
-
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testWrongType() {
+ CdiInjector injector = new CdiInjector(manager.getBeanManager(),
+ String.class);
+ MyPojo pojo = new MyPojo();
+ injector.inject(pojo);
+ }
+
@Test
@Test
- public void testNullObject() {
- fail();
+ public void testNullObject() {
+ CdiInjector injector = new CdiInjector(manager.getBeanManager(),
+ MyPojo.class);
+ injector.inject(null);
+
+ // ok should simply ignore.
}
}
}
}