Package org.jboss.test.kernel.deployment.support

Examples of org.jboss.test.kernel.deployment.support.StaticInjector


      return suite(BeanContainerStaticTestCase.class);
   }

   public void testStaticInjection() throws Throwable
   {
      StaticInjector injector = assertBean("StaticInjector", StaticInjector.class);
      Class<StaticHolder> clazz = StaticHolder.class;
      String string = "foobar";
      Integer number = 123;

      SecurityManager sm = suspendSecurity();
      try
      {
         injector.injectToNonPublicMethod(clazz, "privMain", string, Object.class);
         assertSame(string, StaticHolder.getPrivField());
         injector.injectToNonPublicMethod(clazz, "protMain", string, Object.class);
         assertSame(string, StaticHolder.getProtField());
         injector.injectToMethod(clazz, "pubMain", string, Object.class);
         assertSame(string, StaticHolder.pubField);

         injector.injectToField(clazz, "privField", number);
         assertSame(number, StaticHolder.getPrivField());
         injector.injectToField(clazz, "protField", number);
         assertSame(number, StaticHolder.getProtField());
         injector.injectToField(clazz, "pubField", number);
         assertSame(number, StaticHolder.pubField);
      }
      finally
      {
         resumeSecurity(sm);
View Full Code Here

TOP

Related Classes of org.jboss.test.kernel.deployment.support.StaticInjector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.