Home

Awesome

Build CDI Test CodeQL Coverage (Sonar) Status (Sonar) Maintainability (Sonar) Maven Central

cdi-test: A JUnit extension for easy and efficient testing of CDI components

cdi-test is available under the The Apache Software License, Version 2.0

Why should you use it?

If you're developing Jakarta EE (Java EE) or just plain CDI applications or libraries you'll probably want to unit test your code. If you don't you really should. With cdi-test there's no excuse not to do it ;-)

As CDI doesn't come with any "standard" unit test capabilities you need some way to test your components in your JUnit 5 tests. This is not easily accomplished especially when compared with the junit integration of Spring Boot.

Highlights

cdi-test is targeted at running unit, component and integration tests at scale. It accomplishes this with:

Compatibility

Short example, please!

Most basic:

https://github.com/guhilling/cdi-test/blob/36a3302fa4cae9e66aa0c6fea369a2e92efba70c/cdi-test-core/src/test/java/de/hilling/junit/cdi/SimpleTest.java#L11-L22

Using mocks:

https://github.com/guhilling/cdi-test/blob/36a3302fa4cae9e66aa0c6fea369a2e92efba70c/cdi-test-core/src/test/java/de/hilling/junit/cdi/MockProxyTest.java#L16-L30

In-depth Documentation

See the Documentation on github pages.

Contributing

Contribution guidelines for this project

LICENSE

Copyright 2015 Gunnar Hilling

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.

Sponsors

JProfiler supports open source projects with its full-featured Java Profiler. Click the JProfiler logo below to learn more.

<a href="https://www.ej-technologies.com/products/jprofiler/overview.html" target="_blank" title="JProfiler"> <img src="https://www.ej-technologies.com/images/product_banners/jprofiler_large.png" alt="JProfiler"> </a> <a href="https://www.jetbrains.com/?from=cdi-test" target="_blank" title="JetBrains"> <img src=".logos/jetbrains-variant-2.svg" alt="JetBrains Logo"> </a>