title: Dropwizard integration test: config resource file not found
body: <p>I am trying to assemble a Dropwizard integration test with the following app rule:</p>
  
  <pre class="lang-java prettyprint-override"><code>public static final DropwizardAppRule&lt;MyConfiguration&gt; RULE = new DropwizardAppRule&lt;MyConfiguration&gt;(
          MyApplication.class, ResourceHelpers.resourceFilePath("config_for_test.yml"));
  </code></pre>
  
  <p>When I run the test I get the following error:</p>
  
  <pre><code>java.lang.IllegalArgumentException: resource config_for_test.yml not found.
  </code></pre>
  
  <p>The full stack trace is:</p>
  
  <pre><code>java.lang.ExceptionInInitializerError
      at sun.misc.Unsafe.ensureClassInitialized(Native Method)
      at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:43)
      at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:142)
      at java.lang.reflect.Field.acquireFieldAccessor(Field.java:1082)
      at java.lang.reflect.Field.getFieldAccessor(Field.java:1063)
      at java.lang.reflect.Field.get(Field.java:387)
      at org.junit.runners.model.FrameworkField.get(FrameworkField.java:69)
      at org.junit.runners.model.TestClass.getAnnotatedFieldValues(TestClass.java:156)
      at org.junit.runners.ParentRunner.classRules(ParentRunner.java:215)
      at org.junit.runners.ParentRunner.withClassRules(ParentRunner.java:203)
      at org.junit.runners.ParentRunner.classBlock(ParentRunner.java:163)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:308)
      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.lang.RuntimeException: java.lang.IllegalArgumentException: resource config_for_test.yml not found.
      at io.dropwizard.testing.ResourceHelpers.resourceFilePath(ResourceHelpers.java:23)
      at de.emundo.sortimo.resource.TaskAdditionTest.&lt;clinit&gt;(TaskAdditionTest.java:28)
      ... 18 more
  Caused by: java.lang.IllegalArgumentException: resource ../config_for_test.yml not found.
      at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145)
      at com.google.common.io.Resources.getResource(Resources.java:197)
      at io.dropwizard.testing.ResourceHelpers.resourceFilePath(ResourceHelpers.java:21)
      ... 19 more
  </code></pre>
  
  <p>According to <a href="https://stackoverflow.com/questions/29087777/dropwizard-integration-test-cannot-find-resource-file">another stackoverflow entry</a> I should just use the parent folder <code>../config_for_test.yml</code>. However, this does not solve the problem.</p>