I'm trying following example
from http://www.dropwizard.io/1.0.5/docs/manual/testing.html. This is not
able to find "dev.config.yml". I've tried multiple combinations like
keeping this file test/resources, keeping it in project basedir and even
tried with providing fixed path of file. In all cases I'm getting following
exception.
Thanks for looking into this.
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:1088)
at java.lang.reflect.Field.getFieldAccessor(Field.java:1069)
at java.lang.reflect.Field.get(Field.java:393)
at org.junit.runners.model.FrameworkField.get(FrameworkField.java:73)
at
org.junit.runners.model.TestClass.getAnnotatedFieldValues(TestClass.java:230)
at org.junit.runners.ParentRunner.classRules(ParentRunner.java:255)
at org.junit.runners.ParentRunner.withClassRules(ParentRunner.java:244)
at org.junit.runners.ParentRunner.classBlock(ParentRunner.java:194)
at org.junit.runners.ParentRunner.run(ParentRunner.java:362)
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 D:\GIT\dwtest\src\test\resources\dev.config.yml not found.
at
io.dropwizard.testing.ResourceHelpers.resourceFilePath(ResourceHelpers.java:23)
at santosh.LoginAcceptanceTest.<clinit>(LoginAcceptanceTest.java:29)
... 18 more
Caused by: java.lang.IllegalArgumentException: resource
D:\GIT\dwtest\src\test\resources\dev.config.yml not found.
at
com.google.common.base.Preconditions.checkArgument(Preconditions.java:146)
at com.google.common.io.Resources.getResource(Resources.java:197)
at
io.dropwizard.testing.ResourceHelpers.resourceFilePath(ResourceHelpers.java:21)
... 19 more
public class LoginAcceptanceTest {
@ClassRule
public static final DropwizardAppRule<TestConfiguration> RULE =
new DropwizardAppRule<TestConfiguration>(MyApp.class,
ResourceHelpers.resourceFilePath("dev.config.yaml"));
@Test
public void loginHandlerRedirectsAfterPost() {
Client client = new
JerseyClientBuilder(RULE.getEnvironment()).build("test client");
Response response = client.target(
String.format("http://localhost:%d/login",
RULE.getLocalPort()))
.request()
.post(Entity.json(loginForm()));
assertThat(response.getStatus()).isEqualTo(302);
}}
--
You received this message because you are subscribed to the Google Groups
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.