Unittests mit Mockito
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

209 lines
6.4 KiB

3 years ago
  1. <project xmlns="http://maven.apache.org/POM/4.0.0"
  2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  4. <modelVersion>4.0.0</modelVersion>
  5. <groupId>de.edu.hsfulda.ciip.tdd</groupId>
  6. <artifactId>tannenbaum</artifactId>
  7. <version>1.0-SNAPSHOT</version>
  8. <properties>
  9. <maven.compiler.source>14</maven.compiler.source>
  10. <maven.compiler.target>14</maven.compiler.target>
  11. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  12. <junit.version>5.6.0</junit.version>
  13. <maven-enforcer-plugin.version>3.0.0-M3</maven-enforcer-plugin.version>
  14. <maven-checkstyle-plugin.version>3.1.0</maven-checkstyle-plugin.version>
  15. <checkstyle.version>8.29</checkstyle.version>
  16. <checkstyle-rules.version>4.0.1</checkstyle-rules.version>
  17. <maven-surefire-plugin.version>3.0.0-M4</maven-surefire-plugin.version>
  18. <jacoco-maven-plugin.version>0.8.4</jacoco-maven-plugin.version>
  19. <maven-javadoc-plugin.version>3.0.0</maven-javadoc-plugin.version>
  20. <coveralls-maven-plugin.version>4.3.0</coveralls-maven-plugin.version>
  21. <!-- JaCoCo thresholds. Increase gradually as you add tests. -->
  22. <jacoco.unit-tests.limit.instruction-ratio>0%</jacoco.unit-tests.limit.instruction-ratio>
  23. <jacoco.unit-tests.limit.branch-ratio>0%</jacoco.unit-tests.limit.branch-ratio>
  24. <jacoco.unit-tests.limit.class-complexity>20</jacoco.unit-tests.limit.class-complexity>
  25. <jacoco.unit-tests.limit.method-complexity>5</jacoco.unit-tests.limit.method-complexity>
  26. </properties>
  27. <dependencies>
  28. <dependency>
  29. <groupId>org.junit.jupiter</groupId>
  30. <artifactId>junit-jupiter-api</artifactId>
  31. <version>${junit.version}</version>
  32. <scope>test</scope>
  33. </dependency>
  34. <dependency>
  35. <groupId>org.junit.jupiter</groupId>
  36. <artifactId>junit-jupiter-engine</artifactId>
  37. <version>${junit.version}</version>
  38. <scope>test</scope>
  39. </dependency>
  40. <dependency>
  41. <groupId>org.mockito</groupId>
  42. <artifactId>mockito-core</artifactId>
  43. <version>2.21.0</version>
  44. <scope>test</scope>
  45. </dependency>
  46. <dependency>
  47. <groupId>org.mockito</groupId>
  48. <artifactId>mockito-junit-jupiter</artifactId>
  49. <version>2.23.0</version>
  50. <scope>test</scope>
  51. </dependency>
  52. </dependencies>
  53. <build>
  54. <plugins>
  55. <plugin>
  56. <groupId>org.apache.maven.plugins</groupId>
  57. <artifactId>maven-enforcer-plugin</artifactId>
  58. <version>${maven-enforcer-plugin.version}</version>
  59. <executions>
  60. <execution>
  61. <goals>
  62. <goal>enforce</goal>
  63. </goals>
  64. <configuration>
  65. <rules>
  66. <requireMavenVersion>
  67. <version>3.6.3</version>
  68. </requireMavenVersion>
  69. </rules>
  70. <fail>true</fail>
  71. </configuration>
  72. </execution>
  73. </executions>
  74. </plugin>
  75. <plugin>
  76. <groupId>org.apache.maven.plugins</groupId>
  77. <artifactId>maven-checkstyle-plugin</artifactId>
  78. <version>${maven-checkstyle-plugin.version}</version>
  79. <dependencies>
  80. <dependency>
  81. <groupId>com.puppycrawl.tools</groupId>
  82. <artifactId>checkstyle</artifactId>
  83. <version>${checkstyle.version}</version>
  84. </dependency>
  85. <dependency>
  86. <groupId>com.github.ngeor</groupId>
  87. <artifactId>checkstyle-rules</artifactId>
  88. <version>${checkstyle-rules.version}</version>
  89. </dependency>
  90. </dependencies>
  91. <configuration>
  92. <configLocation>com/github/ngeor/checkstyle.xml</configLocation>
  93. <includeTestSourceDirectory>true</includeTestSourceDirectory>
  94. <skip>true</skip>
  95. </configuration>
  96. <executions>
  97. <execution>
  98. <id>checkstyle</id>
  99. <phase>validate</phase>
  100. <goals>
  101. <goal>check</goal>
  102. </goals>
  103. </execution>
  104. </executions>
  105. </plugin>
  106. <plugin>
  107. <groupId>org.apache.maven.plugins</groupId>
  108. <artifactId>maven-surefire-plugin</artifactId>
  109. <version>${maven-surefire-plugin.version}</version>
  110. </plugin>
  111. <plugin>
  112. <groupId>org.jacoco</groupId>
  113. <artifactId>jacoco-maven-plugin</artifactId>
  114. <version>${jacoco-maven-plugin.version}</version>
  115. <executions>
  116. <execution>
  117. <id>pre-unit-test</id>
  118. <goals>
  119. <goal>prepare-agent</goal>
  120. </goals>
  121. </execution>
  122. <execution>
  123. <id>post-unit-test</id>
  124. <phase>test</phase>
  125. <goals>
  126. <goal>report</goal>
  127. </goals>
  128. </execution>
  129. <execution>
  130. <id>check-unit-test</id>
  131. <phase>test</phase>
  132. <goals>
  133. <goal>check</goal>
  134. </goals>
  135. <configuration>
  136. <dataFile>${project.build.directory}/jacoco.exec</dataFile>
  137. <rules>
  138. <rule>
  139. <element>BUNDLE</element>
  140. <limits>
  141. <limit>
  142. <counter>INSTRUCTION</counter>
  143. <value>COVEREDRATIO</value>
  144. <minimum>${jacoco.unit-tests.limit.instruction-ratio}</minimum>
  145. </limit>
  146. <limit>
  147. <counter>BRANCH</counter>
  148. <value>COVEREDRATIO</value>
  149. <minimum>${jacoco.unit-tests.limit.branch-ratio}</minimum>
  150. </limit>
  151. </limits>
  152. </rule>
  153. <rule>
  154. <element>CLASS</element>
  155. <limits>
  156. <limit>
  157. <counter>COMPLEXITY</counter>
  158. <value>TOTALCOUNT</value>
  159. <maximum>${jacoco.unit-tests.limit.class-complexity}</maximum>
  160. </limit>
  161. </limits>
  162. </rule>
  163. <rule>
  164. <element>METHOD</element>
  165. <limits>
  166. <limit>
  167. <counter>COMPLEXITY</counter>
  168. <value>TOTALCOUNT</value>
  169. <maximum>${jacoco.unit-tests.limit.method-complexity}</maximum>
  170. </limit>
  171. </limits>
  172. </rule>
  173. </rules>
  174. </configuration>
  175. </execution>
  176. </executions>
  177. </plugin>
  178. </plugins>
  179. </build>
  180. <reporting>
  181. <plugins>
  182. <plugin>
  183. <groupId>org.apache.maven.plugins</groupId>
  184. <artifactId>maven-javadoc-plugin</artifactId>
  185. <version>${maven-javadoc-plugin.version}</version>
  186. </plugin>
  187. </plugins>
  188. </reporting>
  189. <profiles>
  190. <!-- Publish coverage report to Coveralls, only when running in Travis. -->
  191. <profile>
  192. <id>travis</id>
  193. <activation>
  194. <property>
  195. <name>env.TRAVIS</name>
  196. </property>
  197. </activation>
  198. <build>
  199. <plugins>
  200. <plugin>
  201. <groupId>org.eluder.coveralls</groupId>
  202. <artifactId>coveralls-maven-plugin</artifactId>
  203. <version>${coveralls-maven-plugin.version}</version>
  204. </plugin>
  205. </plugins>
  206. </build>
  207. </profile>
  208. </profiles>
  209. </project>