junit - I run a unit test with Arquillian, but the console shows me an error -


i run test:

@runwith(arquillian.class) public class greetertest {

@inject greeter greeter;  @deployment public static javaarchive createdeployment() {     javaarchive jar = shrinkwrap.create(javaarchive.class)             .addclass(greeter.class)             .addasmanifestresource(emptyasset.instance, "beans.xml");     system.out.println(jar.tostring(true));     return jar; }  @test public void should_create_greeting() {     assert.assertequals("hello, earthling!",             greeter.creategreeting("earthling"));     greeter.greet(system.out, "earthling"); } 

}

package com.teste;

import java.io.printstream;

public class greeter {

public void greet(printstream to, string name) {     to.println(creategreeting(name)); }  public string creategreeting(string name) {     return "hello, " + name + "!"; } 

}

my pom.xml

http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com teste 0.0.1-snapshot org.jboss.arquillian arquillian-bom 1.1.5.final pom import

    <dependency>         <groupid>org.jboss.arquillian.junit</groupid>         <artifactid>arquillian-junit-container</artifactid>         <scope>test</scope>     </dependency>      <dependency>         <groupid>org.jboss.arquillian.container</groupid>         <artifactid>arquillian-weld-ee-embedded-1.1</artifactid>         <version>1.0.0.cr3</version>         <scope>test</scope>     </dependency>      <dependency>         <groupid>org.jboss.weld</groupid>         <artifactid>weld-core</artifactid>         <version>1.1.5.final</version>         <scope>test</scope>     </dependency>      <dependency>         <groupid>org.slf4j</groupid>         <artifactid>slf4j-simple</artifactid>         <version>1.6.4</version>         <scope>test</scope>     </dependency>  </dependencies> 

but error caused.

java.lang.noclassdeffounderror: javax/ejb/stateless @ org.jboss.arquillian.container.weld.ee.embedded_1_1.mock.ejbs.findejbs(ejbs.java:38)...

anyone know can be? thanks!

i found solution problem, adding dependencies.

     <dependency>         <groupid>org.jboss.spec.javax.ejb</groupid>         <artifactid>jboss-ejb-api_3.1_spec</artifactid>         <scope>test</scope>         <version>1.0.2.final</version>     </dependency>      <dependency>         <groupid>javax.transaction</groupid>         <artifactid>jta</artifactid>         <scope>test</scope>         <version>1.1</version>     </dependency>      <dependency>         <groupid>javax.validation</groupid>         <artifactid>validation-api</artifactid>         <version>1.0.0.ga</version>     </dependency>      <dependency>         <groupid>javax.el</groupid>         <artifactid>javax.el-api</artifactid>         <version>3.0.0</version>         <scope>test</scope>     </dependency> 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -