1 package junitparams.converters; 2 3 import org.junit.Test; 4 import org.junit.runner.RunWith; 5 6 import junitparams.JUnitParamsRunner; 7 import junitparams.Parameters; 8 9 import static org.assertj.core.api.Assertions.*; 10 11 @RunWith(JUnitParamsRunner.class) 12 public class NullableConverterTest { 13 14 @Test 15 @Parameters({"null"}) 16 public void shouldConvertToNull(@Nullable String value) { 17 assertThat(value).isNull(); 18 } 19 20 @Test 21 @Parameters({" null"}) 22 public void shouldConvertToNullIgnoringWhitespaces(@Nullable String value) { 23 assertThat(value).isNull(); 24 } 25 26 @Test 27 @Parameters({"A", "B"}) 28 public void shouldNotApplyConversionToNull(@Nullable String value) { 29 assertThat(value).isNotNull(); 30 } 31 32 @Test 33 @Parameters({" #null "}) 34 public void shouldUseCustomNullIdentifier(@Nullable(nullIdentifier = "#null") String value) { 35 assertThat(value).isNull(); 36 } 37 38 @Test 39 @Parameters({" null "}) 40 public void shouldIgnoreDefaultNulllIdentifierWhenIsSpecifiedCustomOne(@Nullable(nullIdentifier = "#null") String value) { 41 assertThat(value).isNotNull(); 42 } 43 44 @Test 45 @Parameters({"A, B"}) 46 public void shouldNotApplyConversionToNull(@Nullable String firstParam, @Nullable String secondParam) { 47 assertThat(firstParam).isEqualTo("A"); 48 assertThat(secondParam).isEqualTo("B"); 49 } 50 51 52 } 53