1
我嘗試使用JUnitParamsRunner的FileParameters註釋。我無法給變量賦予null。代碼和測試文件如下。如何在使用JUnitParams的@FileParameters時爲參數提供空值
@RunWith(JUnitParamsRunner.class)
public class PasswordCheckerFileParameterizedTest {
@Test
@FileParameters("src/test/resources/testScenarios.csv")
public void checkPasswordIsValid_checkMultipleCase(String password,boolean expectedResult){
PasswordChecker passwordChecker = new PasswordChecker();
assertEquals(expectedResult,passwordChecker.checkPasswordIsValid(password));
}
}
testScenarios.csv
,false
sD1.,false
ssfdsdfsdf234.,false
SEWERWER234.,false
ssfdsdfsdSDFSDF.,false
ssfdsdfsdSDFSDF3234,false
ssfdsdfsdSDFSDF23.,true