Skip to content

Commit

Permalink
https://github.com/BrynCooke/cdi-unit/issues/50
Browse files Browse the repository at this point in the history
Added jandex test
  • Loading branch information
BrynCooke committed May 13, 2014
1 parent 9b48287 commit c3af6d1
Show file tree
Hide file tree
Showing 7 changed files with 169 additions and 2 deletions.
89 changes: 89 additions & 0 deletions cdi-unit-tests-jandex/pom.xml
@@ -0,0 +1,89 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>cdi-unit-tests-jandex</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>org.jglue.cdi-unit</groupId>
<artifactId>cdi-unit-parent</artifactId>
<version>3.0.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<name>CDI-Unit-Tests-Jandex</name>
<url>http://jglue.org/cdi-unit</url>
<description>CDI-Unit test suite.</description>
<developers>
<developer>
<name>Bryn Cooke</name>
</developer>
</developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<weld.test.version>2.2.0.Final</weld.test.version>
</properties>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>


<dependencies>
<dependency>
<groupId>org.jglue.cdi-unit</groupId>
<artifactId>cdi-unit</artifactId>
<version>3.0.2-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.jboss.weld.se</groupId>
<artifactId>weld-se</artifactId>
</exclusion>
</exclusions>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.weld.se</groupId>
<artifactId>weld-se</artifactId>
<version>${weld.test.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jandex</artifactId>
<version>1.2.0.Final</version>
</dependency>

</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jboss.jandex</groupId>
<artifactId>jandex-maven-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution>
<id>make-index</id>
<goals>
<goal>jandex</goal>
</goals>
<!-- phase is 'process-classes by default' -->
<configuration>
<!-- Nothing needed here for simple cases -->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,8 @@
package org.junit.cdiunit;

public class NonTestClass {
public void a() {

}

}
@@ -0,0 +1,20 @@
/*
* Copyright 2011 Bryn Cooke
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jglue.cdiunit;

public class AImplementation1 implements AInterface {

}
@@ -0,0 +1,20 @@
/*
* Copyright 2011 Bryn Cooke
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jglue.cdiunit;

public interface AInterface {

}
@@ -0,0 +1,27 @@
package org.jglue.cdiunit;

import javax.inject.Inject;

import org.junit.Assert;
import org.junit.Test;
import org.junit.cdiunit.NonTestClass;
import org.junit.runner.RunWith;

@RunWith(CdiRunner.class)
@AdditionalClasses(AImplementation1.class)
public class TestCdiRunner {

@Inject
private NonTestClass nonTestClass;

@Inject
AInterface a;

@Test
public void testStart() {
Assert.assertNotNull(a);
Assert.assertNotNull(nonTestClass);
nonTestClass.a();
}

}
6 changes: 4 additions & 2 deletions cdi-unit/pom.xml
@@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>cdi-unit</artifactId>
Expand Down Expand Up @@ -36,7 +37,7 @@
<groupId>org.jboss.weld.se</groupId>
<artifactId>weld-se-core</artifactId>
<scope>compile</scope>
<version>2.1.2.Final</version>
<version>2.2.0.Final</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -102,6 +103,7 @@
<version>2.2.1</version>
<scope>provided</scope>
</dependency>

</dependencies>
<build>
<plugins>
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Expand Up @@ -38,6 +38,7 @@
<module>cdi-unit-tests-mockito</module>
<module>cdi-unit-tests-easymock</module>
<module>cdi-unit-tests-gradle</module>
<module>cdi-unit-tests-jandex</module>
</modules>
<build>
<plugins>
Expand Down

0 comments on commit c3af6d1

Please sign in to comment.