| Line 159: |
Line 159: |
| | assertTimeoutPreemptively(Duration.ofSeconds(3), () -> { demoUtils.checkTimeout(); }, "Method should execute in 3 seconds"); | | assertTimeoutPreemptively(Duration.ofSeconds(3), () -> { demoUtils.checkTimeout(); }, "Method should execute in 3 seconds"); |
| | | | |
| − | === Run tests in order === | + | ===Run tests in order=== |
| | By default the order of the tests is deterministic but not obious, you can force the order<syntaxhighlight lang="java"> | | By default the order of the tests is deterministic but not obious, you can force the order<syntaxhighlight lang="java"> |
| | // MethodOrderer.DisplayName, MethodOrderer..MethodName, MethodOrderer.Random, MethodOrderer.OrderAnnotation | | // MethodOrderer.DisplayName, MethodOrderer..MethodName, MethodOrderer.Random, MethodOrderer.OrderAnnotation |
| Line 179: |
Line 179: |
| | </syntaxhighlight> | | </syntaxhighlight> |
| | | | |
| − | === Configure maven to run tests === | + | ===Configure maven to run tests=== |
| | pom.xml<syntaxhighlight lang="xml"> | | pom.xml<syntaxhighlight lang="xml"> |
| − | <!-- Spring Boot -->
| |
| − |
| |
| − | <dependency>
| |
| − | <groupId>org.springframework.boot</groupId>
| |
| − | <artifactId>spring-boot-starter-test</artifactId>
| |
| − | <scope>test</scope>
| |
| − | </dependency>
| |
| − |
| |
| − | <!-- Java -->
| |
| | <dependency> | | <dependency> |
| | <groupId>org.apache.maven.plugins</groupId> | | <groupId>org.apache.maven.plugins</groupId> |
| Line 199: |
Line 190: |
| | </syntaxhighlight> | | </syntaxhighlight> |
| | | | |
| − | === Code coverage === | + | ===Code coverage=== |
| | IntelliJ has built-in support for code coverage Maven can too, requires plugin like maven-surefire-report-plugin<syntaxhighlight lang="xml"> | | IntelliJ has built-in support for code coverage Maven can too, requires plugin like maven-surefire-report-plugin<syntaxhighlight lang="xml"> |
| | <build> | | <build> |
| Line 236: |
Line 227: |
| | </syntaxhighlight> | | </syntaxhighlight> |
| | | | |
| − | === JaCoCo (Java Code Coverage) === | + | ===JaCoCo (Java Code Coverage)=== |
| | <syntaxhighlight lang="xml"> | | <syntaxhighlight lang="xml"> |
| | ... | | ... |
| Line 263: |
Line 254: |
| | </syntaxhighlight> | | </syntaxhighlight> |
| | | | |
| − | === Disable tests === | + | ===Disable tests=== |
| | <syntaxhighlight lang="java"> | | <syntaxhighlight lang="java"> |
| | class ConditionalTest { | | class ConditionalTest { |
| Line 294: |
Line 285: |
| | </syntaxhighlight> | | </syntaxhighlight> |
| | | | |
| − | === Parameterized Tests === | + | ===Parameterized Tests=== |
| | <syntaxhighlight lang="java"> | | <syntaxhighlight lang="java"> |
| | // @parameterizedTest | | // @parameterizedTest |