@ParameterizedTest @CsvFileSource(resources = "/input.csv") void testWithCsvFileSource(String first, int second) { System.out.println("Yet another parameterized test with (String) " + first + " and (int) " + second); assertNotNull(first); assertNotEquals(0, second); }
@ParameterizedTest(name = "{index} => verify({0}) should return {1}") @CsvFileSource(resources = {"/urls.csv"}, delimiter = ';') public void urlTests( final String url, int expectedResult) throws IOException { LOGGER.log(Level.INFO, "Testing {0} with expected HTTP status code: {1}", new Object[]{ url, expectedResult }); assertEquals(expectedResult, ( (HttpURLConnection) new URL( url ).openConnection()).getResponseCode() ); }
@ParameterizedTest @CsvFileSource(resources = "/data.csv") void roman_number_test(int given, String expected) throws Exception { RomanKataConverter converter = new RomanKataConverter(); assertEquals(expected,converter.convert(given)); }