Git Product home page Git Product logo

weld-junit's Introduction

Weld JUnit Extensions

Travis CI Build Status Maven Central License

The primary goal of this project is to provide simple and fast tools for CDI unit/component testing. The tools are implemented as JUnit 4 and JUnit 5 extensions. Supports 3.0 (CDI 2.0).

The What

Weld JUnit extensions allow you to write unit tests for your beans regardless of the target environment (Java SE, Java EE, etc.). It starts a real CDI container in minimal configuration meaning you can leverage all bean capabilities - injection, interception, events, etc. - without the need for mocking. These extensions boot up CDI container before each test container run and shut it down afterwards. You have the power to customize what beans, extensions, interceptors (and so on) are going to be in the container. Furthermore, you can @Inject directly in your test class - and the list goes on...

The Why

As a matter of fact, one could have a unit test for CDI bean without running a container, but that would present quite a few drawbacks. Simulating field injection to start with, then interceptors and/or decorators - all in all, quite a challenge. There are frameworks to make this easier such as Mockito; but use too many mocks and things get tangled real quick. So we came with JUnit extensions which allow you to use actual CDI container instead of complex simulations. There is no need to change the way you develop your CDI components if you have a real container to test it with. Besides, it's easy to combine this approach with mocking frameworks (see also Adding mock beans).

How To Use Each Extension

This project consists of three modules. Below is a list with links to detailed README of each extension:

weld-junit's People

Contributors

mkouba avatar manovotn avatar kdubb avatar smoyer64 avatar kaiwinter avatar mareknovotny avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.