title: ClassNotFoundException on static inner class
body: <p>I'm getting a <code>ClassNotFoundException</code> using <code>Class.forName()</code> passing the fully qualified name of a public static class that lives inside the same package. This is when running my tests.</p>
  
  <p>Here's the full stacktrace:</p>
  
  <pre><code>java.lang.AssertionError
      at org.junit.Assert.fail(Assert.java:86)
      at org.junit.Assert.assertTrue(Assert.java:41)
      at org.junit.Assert.assertNotNull(Assert.java:712)
      at org.junit.Assert.assertNotNull(Assert.java:722)
      at com.badlogic.ashley.serialization.EntitySerializerTests.read(EntitySerializerTests.java:63)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:483)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
      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.junit.runners.Suite.runChild(Suite.java:128)
      at org.junit.runners.Suite.runChild(Suite.java:27)
      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.junit.runner.JUnitCore.run(JUnitCore.java:137)
      at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:119)
      at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
      at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
      at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:483)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
  </code></pre>
  
  <p>In <code>EntitySerializerTests.java</code> inside my <code>tests</code> folder.</p>
  
  <pre><code>package com.badlogic.ashley.serialization;
  public class EntitySerializerTests {
  
      public static class TestComponentA implements Component {
          public int value;
      }
  
      ...
  }
  </code></pre>
  
  <p>In my library code</p>
  
  <pre><code>package com.badlogic.ashley.serialization;
  public class EntitySerializer implements Json.Serializer&lt;Entity&gt; {
      ...
  
      private Component read(Json json, JsonValue componentValue) throws ClassNotFoundException {
          String className = componentValue.name();
          Class componentType = Class.forName(className); // THROWS
          ...
      }
  }
  </code></pre>
  
  <p>The exception message is:</p>
  
  <pre><code>java.lang.ClassNotFoundException: com.badlogic.ashley.serialization.EntitySerializerTests.TestComponentA
  </code></pre>
  
  <p>Library code is trying to get the <code>Class</code> given the name for a class that's defined in a test file. Is that allowed? I would assume that, at runtime, all these classes are available in the class path.</p>
  
  <p>Thanks.</p>