java - Integration tests fails if run via maven, but passes if run via IDE -
i have acceptance test module ejb call module. acceptance test, don't want call ejb directly may cause tests slow. on come that, used simplenamingcontextbuilder
mock jndi call. acceptance test, using cucumber
framework.
i created own annotation @mockjndiservices
, java method jndi looks like
@before("@mockjndientityservice") public void mockjndiservice() throws namingexception { final ejbserviceremote ejbservice = new ejbserviceremotestubimpl(); final simplenamingcontextbuilder contextbuilder = new simplenamingcontextbuilder(); contextbuilder.bind(ejbserviceremote.ejb_name, ejbservice); contextbuilder.activate(); }
ejbserviceremotestubimpl
stub tests call instead of service itself.
and feature file has heading
@mockjndientityservice @transaction feature: lookups library of policy
when run code via ide (intellij
), works fine , passes. when run through build tool (maven
), remote lookup failure
caused by: javax.naming.namenotfoundexception: name [ejb/ejbserviceejb#ejb.service.ejbserviceremote] not bound; 1 bindings: [ejb/ejbserviceejb#ejb.service.ejbserviceremote
it seems annotation not being applied each feature/scenarios.
has ever came across this? appreciated.
Comments
Post a Comment