title: Mocking the UIInput class for tests
body: <p>I am trying to mock javax.faces.component.UIInput class.</p>
  
  <p>My class is as below</p>
  
  <pre><code>public class MyBean{
  
      private UIInput someInput;  
  
     //setters and getters
  
  }
  </code></pre>
  
  <p><strong>Test case</strong></p>
  
  <pre><code>UIInput mockedVale = Mockito.mock(UIInput.class);
  MyBean myBean = new MyBean();
  myBean.setSomeInput(mockedVale);
  </code></pre>
  
  <p>Can some one help me to fix this</p>
  
  <pre><code>java.lang.ExceptionInInitializerError
      at sun.reflect.GeneratedSerializationConstructorAccessor3.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
      at org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.newInstance(SunReflectionFactoryInstantiator.java:45)
      at org.objenesis.ObjenesisBase.newInstance(ObjenesisBase.java:73)
      at org.mockito.internal.creation.jmock.ClassImposterizer.createProxy(ClassImposterizer.java:142)
      at org.mockito.internal.creation.jmock.ClassImposterizer.imposterise(ClassImposterizer.java:61)
      at org.mockito.internal.creation.jmock.ClassImposterizer.imposterise(ClassImposterizer.java:52)
      at org.mockito.internal.creation.CglibMockMaker.createMock(CglibMockMaker.java:24)
      at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:32)
      at org.mockito.internal.MockitoCore.mock(MockitoCore.java:59)
      at org.mockito.Mockito.mock(Mockito.java:1258)
      at org.mockito.Mockito.mock(Mockito.java:1135)
      at se.telenor.ocfd.web.facade.MyBean.&lt;init&gt;(MyBean.java:28)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
      at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:217)
      at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:266)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:263)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
  Caused by: java.util.MissingResourceException: Can't find javax.faces.LogStrings bundle
      at java.util.logging.Logger.setupResourceInfo(Logger.java:1945)
      at java.util.logging.Logger.&lt;init&gt;(Logger.java:380)
      at java.util.logging.LogManager.demandLogger(LogManager.java:554)
      at java.util.logging.Logger.demandLogger(Logger.java:455)
      at java.util.logging.Logger.getLogger(Logger.java:553)
      at javax.faces.component.UIComponent.&lt;clinit&gt;(UIComponent.java:116)
      ... 35 more
  </code></pre>