Unit testing for CDI applications
Java Other
Permalink
Failed to load latest commit information.
cdi-unit-tests-bare Bump version to 4.1.0-SNAPSHOT Jun 19, 2018
cdi-unit-tests-easymock
cdi-unit-tests-external-dependency
cdi-unit-tests-gradle Use FastClasspathScanner and Java 7/8 features Jun 24, 2018
cdi-unit-tests-jandex Bump version to 4.1.0-SNAPSHOT Jun 19, 2018
cdi-unit-tests-mockito Bump version to 4.1.0-SNAPSHOT Jun 19, 2018
cdi-unit-tests Use FastClasspathScanner and Java 7/8 features Jun 24, 2018
cdi-unit Use FastClasspathScanner and Java 7/8 features Jun 24, 2018
docs
.gitignore
.travis.yml
README.md Update README.md Sep 17, 2017
logback-maven.xml Configure logging for maven build Mar 12, 2017
pom.xml Use FastClasspathScanner and Java 7/8 features Jun 24, 2018
test-multi.sh Support Weld 3.0 (#115) Jul 12, 2017

README.md

cdi-unit

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

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

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

<dependency>
  <groupId>org.jglue.cdi-unit</groupId>
  <artifactId>cdi-unit</artifactId>
  <version>4.0.1</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 from 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.