Rev 91 | Rev 93 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 91 | Rev 92 | ||
---|---|---|---|
Line 194... | Line 194... | ||
194 | }
|
194 | }
|
195 | 195 | ||
196 | @Test |
196 | @Test |
197 | public void testPrimitiveInitValue2() { |
197 | public void testPrimitiveInitValue2() { |
198 | 198 | ||
199 | Factory f = new ClassFactory(TestObj3_1.class).addInitValue(new Integer(20)); |
- | |
- | 199 | Factory f = new ClassFactory(TestObj3_1.class).addInitValue(20); |
|
200 | 200 | ||
201 | TestObj3_1 o = f.getInstance(); |
201 | TestObj3_1 o = f.getInstance(); |
202 | 202 | ||
203 | Assert.assertEquals(20, o.x); |
203 | Assert.assertEquals(20, o.x); |
204 | }
|
204 | }
|
205 | 205 | ||
- | 206 | private static class TestObj3_2 { |
|
- | 207 | ||
- | 208 | int x; |
|
- | 209 | long l; |
|
- | 210 | ||
- | 211 | public TestObj3_2(Integer x, long l) { |
|
- | 212 | this.x = x; |
|
- | 213 | this.l = l; |
|
- | 214 | }
|
|
- | 215 | }
|
|
- | 216 | ||
- | 217 | @Test |
|
- | 218 | public void testPrimitiveInitValue3() { |
|
- | 219 | ||
- | 220 | Factory f = new ClassFactory(TestObj3_2.class).addInitValue(20).addInitPrimitive(30L); |
|
- | 221 | ||
- | 222 | TestObj3_2 o = f.getInstance(); |
|
- | 223 | ||
- | 224 | Assert.assertEquals(20, o.x); |
|
- | 225 | Assert.assertEquals(30L, o.l); |
|
- | 226 | }
|
|
206 | 227 | ||
207 | private static class TestObj4 { |
228 | private static class TestObj4 { |
208 | 229 | ||
209 | int x; |
230 | int x; |
210 | String s; |
231 | String s; |
Line 220... | Line 241... | ||
220 | }
|
241 | }
|
221 | 242 | ||
222 | @Test |
243 | @Test |
223 | public void testMixInitValues() { |
244 | public void testMixInitValues() { |
224 | 245 | ||
225 | Factory f = new ClassFactory(TestObj4.class).addInitValue(20).addInitValue("hello").addInitValue(new Long(20)).addInitValue(20L); |
- | |
- | 246 | Factory f = new ClassFactory(TestObj4.class).addInitPrimitive(20).addInitValue("hello").addInitValue(20L).addInitPrimitive(20L); |
|
226 | 247 | ||
227 | TestObj4 o = f.getInstance(); |
248 | TestObj4 o = f.getInstance(); |
228 | 249 | ||
229 | Assert.assertEquals(20, o.x); |
250 | Assert.assertEquals(20, o.x); |
230 | Assert.assertEquals("hello", o.s); |
251 | Assert.assertEquals("hello", o.s); |