CDI-Unit

JUnit runner for testing CDI based projects.

License

License

GroupId

GroupId

org.jglue.cdi-unit
ArtifactId

ArtifactId

cdi-unit
Last Version

Last Version

4.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

CDI-Unit
JUnit runner for testing CDI based projects.

Download cdi-unit

How to add to project

<!-- https://jarcasting.com/artifacts/org.jglue.cdi-unit/cdi-unit/ -->
<dependency>
    <groupId>org.jglue.cdi-unit</groupId>
    <artifactId>cdi-unit</artifactId>
    <version>4.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.jglue.cdi-unit/cdi-unit/
implementation 'org.jglue.cdi-unit:cdi-unit:4.1.0'
// https://jarcasting.com/artifacts/org.jglue.cdi-unit/cdi-unit/
implementation ("org.jglue.cdi-unit:cdi-unit:4.1.0")
'org.jglue.cdi-unit:cdi-unit:jar:4.1.0'
<dependency org="org.jglue.cdi-unit" name="cdi-unit" rev="4.1.0">
  <artifact name="cdi-unit" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.jglue.cdi-unit', module='cdi-unit', version='4.1.0')
)
libraryDependencies += "org.jglue.cdi-unit" % "cdi-unit" % "4.1.0"
[org.jglue.cdi-unit/cdi-unit "4.1.0"]

Dependencies

compile (5)

Group / Artifact Type Version
org.javassist : javassist jar 3.18.1-GA
io.github.classgraph : classgraph jar 4.1.2
org.slf4j : slf4j-api jar 1.7.5
org.apache.deltaspike.core : deltaspike-core-impl jar 1.0.1
org.jboss.resteasy : resteasy-jaxrs jar 3.0.14.Final

provided (13)

Group / Artifact Type Version
org.jboss.weld.se : weld-se-core jar 3.0.0.Final
org.jboss.weld.module : weld-web jar 3.0.0.Final
junit : junit jar 4.12
org.testng : testng jar 6.11
org.mockito : mockito-core jar 2.19.0
org.easymock : easymock jar 3.2
javax.servlet : javax.servlet-api jar 3.0.1
com.sun.faces : jsf-api jar 2.2.1
javax.ejb : javax.ejb-api jar 3.2
javax.ws.rs : javax.ws.rs-api jar 2.0.1
org.apache.deltaspike.modules : deltaspike-jpa-module-impl jar 1.0.1
org.hibernate : hibernate-entitymanager jar 4.3.6.Final
org.apache.deltaspike.modules : deltaspike-data-module-impl jar 1.0.1

test (2)

Group / Artifact Type Version
ch.qos.logback : logback-classic jar 1.0.9
com.h2database : h2 jar 1.4.180

Project Modules

There are no modules declared in this project.

cdi-unit

Unit testing for CDI applications. Supports Mockito for mocking dependencies.

See website for full details http://cdi-unit.github.io/cdi-unit

Discussion can be found here https://groups.google.com/forum/#!forum/cdi-unit

Maven Central

<dependency>
  <groupId>org.jglue.cdi-unit</groupId>
  <artifactId>cdi-unit</artifactId>
  <version>${cdi-unit-version}</version>
  <scope>test</scope>
</dependency>
class Starship {
 
  @Inject
  Engine engine; //We don't know the exact engine that this ship will have.
 
  void start() {
    engine.start();
  }
}

@RunWith(CdiRunner.class)
@AdditionalClasses(WarpDrive.class) // WarpDrive is available to use.
class TestStarship {
 
  @Inject
  Starship starship;
 
  @Test
  public void testStart() {
    starship.start(); // Going to warp!
  }
}

Acknowledgements

This project uses code shamelessly copied from:

Mockrunner under Apache license. Resteasy under Apache license.

License

Copyright 2013 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.

Versions

Version
4.1.0
4.0.2
4.0.1
4.0.0
3.1.4
3.1.3
3.1.2
3.1.1
3.1.0
3.0.1
3.0.0
2.2.1
2.2.0
2.1.1
2.1.0
2.0.8
2.0.7
2.0.6
2.0.5
2.0.4