intellij idea - Dropwizard integration test cannot find resource file -


very new dropwizard, trying create integration test "exactly" how have example:

https://dropwizard.github.io/dropwizard/manual/testing.html public class loginacceptancetest {  @classrule public static final dropwizardapprule<testconfiguration> rule =         new dropwizardapprule<testconfiguration>(myapp.class, resourcehelpers.resourcefilepath("dev-config.yml"));  @test public void loginhandlerredirectsafterpost() {     //client client = new jerseyclientbuilder(rule.getenvironment()).build("test client");   } } 

so far having 2 issues: first of when run test intellij fails following exception:

caused by: java.lang.illegalargumentexception: resource dev-config.yml not found. 

full stacktrace:

java.lang.exceptionininitializererror @ sun.misc.unsafe.ensureclassinitialized(native method) @ sun.reflect.unsafefieldaccessorfactory.newfieldaccessor(unsafefieldaccessorfactory.java:43) @ sun.reflect.reflectionfactory.newfieldaccessor(reflectionfactory.java:140) @ java.lang.reflect.field.acquirefieldaccessor(field.java:1057) @ java.lang.reflect.field.getfieldaccessor(field.java:1038) @ java.lang.reflect.field.get(field.java:379) @ org.junit.runners.model.frameworkfield.get(frameworkfield.java:73) @ org.junit.runners.model.testclass.getannotatedfieldvalues(testclass.java:230) @ org.junit.runners.parentrunner.classrules(parentrunner.java:255) @ org.junit.runners.parentrunner.withclassrules(parentrunner.java:244) @ org.junit.runners.parentrunner.classblock(parentrunner.java:194) @ org.junit.runners.parentrunner.run(parentrunner.java:362) @ org.junit.runner.junitcore.run(junitcore.java:137) @ com.intellij.junit4.junit4ideatestrunner.startrunnerwithargs(junit4ideatestrunner.java:74) @ com.intellij.rt.execution.junit.junitstarter.preparestreamsandstart(junitstarter.java:211) @ com.intellij.rt.execution.junit.junitstarter.main(junitstarter.java:67) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ com.intellij.rt.execution.application.appmain.main(appmain.java:134) caused by: java.lang.runtimeexception: java.lang.illegalargumentexception: resource dev-config.yml not found. @ io.dropwizard.testing.resourcehelpers.resourcefilepath(resourcehelpers.java:23) @ com.amplify.ckla.resources.teacherconfigresourceintegrationtest.<clinit>(teacherconfigresourceintegrationtest.java:12) ... 21 more caused by: java.lang.illegalargumentexception: resource dev-config.yml not found. @ com.google.common.base.preconditions.checkargument(preconditions.java:145) @ com.google.common.io.resources.getresource(resources.java:197) @ io.dropwizard.testing.resourcehelpers.resourcefilepath(resourcehelpers.java:21) ... 22 more 

the dev-config.yml there:

ls -a  .               .idea               build.sh            pom.xml ..              ckla.iml            dev-config.yml          src .git                readme.md                       target .gitignore          develop.sh            

change run directory of program root of project (the 1 output of ls -a command). running ./target directory.

or if want/need run .target change command line options refer configuration file to: ../dev-config.yml

edit: @nightograph commented exact thing in intellij right click on project folder , mark directory "resources root"


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -