Bean Validation

67 views
Skip to first unread message

Travis Zimmerman

unread,
Nov 27, 2015, 2:03:52 PM11/27/15
to CDI-Unit
Hey great tool! 

I believe I have everything set up properly. Rather large project, heavily based on injection. I have gotten many things working including EntityManager. Where I am now running into an issue is injecting a javax.validation.Validator. I get the following error when trying to run my test case. I have tried adding this to AdditionalClasspath, AdditionalClass and AdditionalPackage but all of these seem to fail. I didn't have to do anything special for EntityManager, just included my main classpath in AdditionalClasspath. Any clue why this wouldnt work? Need more info?

Thanks much.

java.lang.Exception: Unable to start weld
at org.jglue.cdiunit.CdiRunner.createTest(CdiRunner.java:91)
at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:227)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:224)
at com.businesstrack.WeldRunner.methodBlock(WeldRunner.java:119)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
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: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type Validator with qualifiers @HibernateValidator
  at injection point [BackedAnnotatedField] @Inject @HibernateValidator private com.fdc.boarding.core.service.EntityDao.validator
  at com.fdc.boarding.core.service.EntityDao.validator(EntityDao.java:0)
....

Bryn Cooke

unread,
Nov 29, 2015, 11:22:04 AM11/29/15
to CDI-Unit
Hi,
Try using the additional classpath annotation with a class in your validatior implementation library.

Bryn
Reply all
Reply to author
Forward
0 new messages