October 2017
Intermediate to advanced
350 pages
7h 29m
English
If the implicit conversion provided by JUnit 5 is not enough to cover our needs, we can use the explicit conversion capability. Thanks to this feature, we can specify a class which is going to make the custom conversion of parameter types. This custom converter is identified with the annotation @ConvertWith, referring to the argument to be converted with. Consider the following example. This parameterized test declares a custom converter for its test method argument:
package io.github.bonigarcia;import static org.junit.jupiter.api.Assertions.assertNotNull;import java.util.concurrent.TimeUnit;import org.junit.jupiter.params.ParameterizedTest;import org.junit.jupiter.params.converter.ConvertWith;import org.junit.jupiter.params.provider.EnumSource; ...
Read now
Unlock full access