Test Pojos Maven Plugin

Unit test pojos

Лицензия

Лицензия

Категории

Категории

Maven Компиляция и сборка
Группа

Группа

org.honton.chas
Идентификатор

Идентификатор

testpojo-maven-plugin
Последняя версия

Последняя версия

0.0.9
Дата

Дата

Тип

Тип

maven-plugin
Описание

Описание

Test Pojos Maven Plugin
Unit test pojos
Ссылка на сайт

Ссылка на сайт

https://github.com/chonton/testpojo-maven-plugin
Система контроля версий

Система контроля версий

https://github.com/chonton/testpojo-maven-plugin

Скачать testpojo-maven-plugin

Как подключить последнюю версию

<plugin>
    <groupId>org.honton.chas</groupId>
    <artifactId>testpojo-maven-plugin</artifactId>
    <version>0.0.9</version>
</plugin>

Зависимости

compile (7)

Идентификатор библиотеки Тип Версия
com.fasterxml.jackson.core : jackson-core jar 2.9.8
com.fasterxml.jackson.core : jackson-databind jar 2.9.8
com.fasterxml.jackson.datatype : jackson-datatype-guava jar 2.9.8
com.fasterxml.jackson.datatype : jackson-datatype-joda jar 2.9.8
com.fasterxml.jackson.datatype : jackson-datatype-jsr310 jar 2.9.8
org.apache.maven : maven-plugin-api jar 3.0
org.reflections : reflections jar 0.9.10

provided (2)

Идентификатор библиотеки Тип Версия
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.2
org.projectlombok : lombok jar 1.16.6

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12

Модули Проекта

Данный проект не имеет модулей.

testpojo-maven-plugin

Test pojos using maven plugin instead of boilerplate. Just as lombok can reduce writing bolierplate for POJOs, this plugin can reduce the unit tests you need to write.

Requirements

This plugin is designed to used with jacoco maven plugin.

Maven Configuration

To include testpojo-maven-plugin in your maven build, use the following fragment in your pom.

  <build>
    <plugins>
      <plugin>
        <groupId>org.honton.chas</groupId>
        <artifactId>testpojo-maven-plugin</artifactId>
        <version>0.0.9</version>
        <executions>
          <execution>
            <id>test-pojos</id>
            <goals>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

testpojo-maven-plugin provides a single 'test' goal which defaults to running in the test phase.

What gets tested

How testpojo-maven-plugin works

Using Reflections, all code in the ${build.outputDirectory} is introspected. Any class with method implementations for both equals and hashCode and has a public constructor is considered a bean.

Parameter Default Description
testpojo.skip ${skipTests} Skip testing pojos

Bean test consists of the following steps.

  1. Construct bean with public constructor having least number of arguments.
  2. Execute toString() and make sure no exceptions occur.
  3. Use Jackson to marshall to Map and back to new instance of POJO.
  • Check copy.equals(original)
  • Check copy.hashCode() == original.hashCode()
  1. Use Jackson to marshall to json string and back to new instance of POJO.
  • Check copy.equals(original)
  • Check copy.hashCode() == original.hashCode()
  1. Create variants by executing each setter with value. If the Bean has a Lombok @Builder, the builder will be used to populate the bean instead of setters.
  • Check !variant.equals(original)
  • Execute steps 2-4 above

Версии библиотеки

Версия
0.0.9
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1