Powerunit - Java Testing framework for JDK 1.8 - Extension to provide matchers based on annotations. - ProvideMatchers Support

This is a test framework for the JDK 1.8 - Extension to provide matchers based on annotation. - ProvideMatchers Support

License

License

Categories

Categories

IDE Development Tools
GroupId

GroupId

ch.powerunit.extensions
ArtifactId

ArtifactId

powerunit-extensions-matchers-providematchers
Last Version

Last Version

0.1.6
Release Date

Release Date

Type

Type

jar
Description

Description

Powerunit - Java Testing framework for JDK 1.8 - Extension to provide matchers based on annotations. - ProvideMatchers Support
This is a test framework for the JDK 1.8 - Extension to provide matchers based on annotation. - ProvideMatchers Support
Project URL

Project URL

http://www.powerunit.ch/powerunit-extensions-matchers
Source Code Management

Source Code Management

https://github.com/powerunit/powerunit-extensions-matchers/

Download powerunit-extensions-matchers-providematchers

How to add to project

<!-- https://jarcasting.com/artifacts/ch.powerunit.extensions/powerunit-extensions-matchers-providematchers/ -->
<dependency>
    <groupId>ch.powerunit.extensions</groupId>
    <artifactId>powerunit-extensions-matchers-providematchers</artifactId>
    <version>0.1.6</version>
</dependency>
// https://jarcasting.com/artifacts/ch.powerunit.extensions/powerunit-extensions-matchers-providematchers/
implementation 'ch.powerunit.extensions:powerunit-extensions-matchers-providematchers:0.1.6'
// https://jarcasting.com/artifacts/ch.powerunit.extensions/powerunit-extensions-matchers-providematchers/
implementation ("ch.powerunit.extensions:powerunit-extensions-matchers-providematchers:0.1.6")
'ch.powerunit.extensions:powerunit-extensions-matchers-providematchers:jar:0.1.6'
<dependency org="ch.powerunit.extensions" name="powerunit-extensions-matchers-providematchers" rev="0.1.6">
  <artifact name="powerunit-extensions-matchers-providematchers" type="jar" />
</dependency>
@Grapes(
@Grab(group='ch.powerunit.extensions', module='powerunit-extensions-matchers-providematchers', version='0.1.6')
)
libraryDependencies += "ch.powerunit.extensions" % "powerunit-extensions-matchers-providematchers" % "0.1.6"
[ch.powerunit.extensions/powerunit-extensions-matchers-providematchers "0.1.6"]

Dependencies

compile (4)

Group / Artifact Type Version
org.hamcrest : hamcrest-all jar 1.3
javax.xml.bind : jaxb-api jar 2.3.0
com.sun.xml.bind : jaxb-impl jar 2.3.0
com.sun.xml.bind : jaxb-core jar 2.3.0

provided (1)

Group / Artifact Type Version
javax.annotation : javax.annotation-api Optional jar 1.3.1

test (5)

Group / Artifact Type Version
ch.powerunit : powerunit jar 0.5.0
com.google.code.bean-matchers : bean-matchers Optional jar 0.11
org.exparity : hamcrest-date Optional jar 2.0.4
com.nitorcreations : matchers Optional jar 1.3
com.spotify : hamcrest-jackson Optional jar 1.1.1

Project Modules

There are no modules declared in this project.

powerunit-extensions-matchers

  • Travis ci : Build Status
  • Vulnerabilities : Known Vulnerabilities DepShield Badge
  • Coverage : Coverage Status - codecov
  • Quality : Codacy Badge - CodeFactor - BCH compliance - codebeat badge
  • Maven : Maven Central
  • Git : mergify-status

This is an extension to powerunit (a unit test framework for java 8) that doesn't require this framework, but provides generation of hamcrest matchers. Please check the site for more information

Usage

Basic usage is to add this libraray as a dependency and use the annotation :

@ProvideMatchers
public class PojoShort {
  ...
}

Matchers classes must be created by the annotation processor (in this example, named PojoShortMatchers).

Compatibility

Powerunit-extensions-matchers version With Version Status
0.1.6 hamcrest 1.3 ✔️
0.1.6 hamcrest 2.1+ Not tested by itself, but as some extension use this version, should be OK
0.1.6 JDK 1.8 ✔️
0.1.6 JDK 9 Compilation with source and target = 1.8 tested. The @Generated annotation may not be available OOTB and the META-INF information are not generated
0.1.6 JDK 10 Compilation with source and target = 1.8 tested. The @Generated annotation may not be available OOTB and the META-INF information are not generated
0.2.0 hamcrest 1.3 ✔️ The @Factory annotation is not produced or parsed anymore.
0.2.0 hamcrest 2.1+ ✔️
0.2.0 JDK 1.8 ✔️
0.2.0 JDK 9 Compilation with source and target = 1.8 tested. Execution of generated matcher tested. The @Generated annotation may not be available OOTB.
0.2.0 JDK 10 Compilation with source and target = 1.8 tested. Execution of generated matcher tested. The @Generated annotation may not be available OOTB.
0.3.0 hamcrest 1.3 ✔️
0.3.0 hamcrest 2.1+ ✔️
0.3.0 JDK 1.8 ✔️
0.3.0 JDK 9 Compilation with source and target = 1.9 tested. Execution of generated matcher tested. The @Generated annotation may not be available OOTB.
0.3.0 JDK 10 Compilation with source and target = 1.9 tested. Execution of generated matcher tested. The @Generated annotation may not be available OOTB.
0.3.0 powerunit-extensions-matchers 0.2.0 ✔️ Matchers generated with version 0.2.0 can be used from matcher of the version 0.3.0. The ignored fields and cycle detection is not propagated to the 0.2.0 matchers.

Migration

Migration to version 0.2.X

The version 0.2.0 introduces some major changes in the annotation processor. The idea is mainly that this annotation processor must support several version of the hamcrest library.

When migrating to this version, some actions may be needed :

  • The library doesn't provide anymore a transitive dependency to the hamcrest library. You may need to add this library as a dependency of your project. Dependency may be : org.hamcrest:hamcrest:2.2 ; org.hamcrest:hamcrest:2.1 ; org.hamcrest:hamcrest-all:1.3.
  • The artifacts powerunit-extensions-matchers-factory and powerunit-extensions-matchers-providematchers are not available any more. Only the master artifact powerunit-extensions-matchers is available and only this one can be used.
  • The generated classes doesn't use anymore the @Factory annotation. This annotation only exists in hamcrest 1.3. If you use the annotation processor based on the configuration property ch.powerunit.extensions.matchers.factoryprocessor.FactoryAnnotationsProcessor.targets you will have to change your configuration (see below). This feature was based on this annotation and only compatible with hamcrest 1.3
  • By default, the annotation processor only generate the Matchers. If a master DSL interface is required (like the ones produced by the old configuration ch.powerunit.extensions.matchers.factoryprocessor.FactoryAnnotationsProcessor.targets you may use the configuration property ch.powerunit.extensions.matchers.provideprocessor.ProvidesMatchersAnnotationsProcessor.factory. This property takes as value the fully qualified name of an interface to be generated, which will expose all the entry DSL methods generated by this annotation processor. This interface only contains these entry DSL methods ; no additional methods may be added (as it was possible before with @Factory annotation).
  • The detection of link between classes and related Matcher has been enhanced. It is possible that for some case when before a field or a parent was not linked, now there are correctly linked. It may change the way the matcher operate (using another matcher to compare and not a is Matcher).
  • The META-INF xml file is not generated anymore. This should not be an issue, except if you use it. Metadatas information are added directly to the generated matchers.
ch.powerunit.extensions

Versions

Version
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4