ottlinger commented on code in PR #195: URL: https://github.com/apache/creadur-rat/pull/195#discussion_r1451623232
########## apache-rat-core/src/test/java/org/apache/rat/analysis/matchers/CopyrightMatcherTest.java: ########## @@ -53,91 +53,99 @@ public class CopyrightMatcherTest { private static final int TOTAL_TESTS = prefix.length * 9; - static Object[] startStopOwner = { "start-stop-owner", "1990", "1991", "an owner", - new String[][] { DO, OD, DOS, ODS }, new String[][] { D, S, O, OS, SO } }; - static Object[] startOwner = { "start-owner", "1990", null, "an owner", new String[][] { OS, SO, OD, ODS }, - new String[][] { D, DO, DOS, S, O } }; - static Object[] start = { "start", "1990", null, null, new String[][] { D, DO, DOS, S, SO }, - new String[][] { OD, ODS, O, OS } }; - static Object[] owner = { "owner", null, null, "an owner", new String[][] { O, OD, ODS, OS }, - new String[][] { DO, DOS, S, D, SO } }; - static Object[] nada = { "nada", null, null, null, new String[][] { D, DO, DOS, S, SO }, - new String[][] { OD, ODS, O, OS } }; - - private final CopyrightMatcher matcher; - private final String[][] pass; - private final String[][] fail; - private final String testName; - - @Parameters(name = "{0}") - public static Collection<Object[]> data() { - return Arrays.asList(expandResults(startStopOwner), expandResults(startOwner), expandResults(start), - expandResults(owner), expandResults(nada)); + static Arguments startStopOwner = Arguments.of("start-stop-owner", "1990", "1991", "an owner", + expandResults( DO, OD, DOS, ODS) , expandResults( D, S, O, OS, SO )); + static Arguments startOwner = Arguments.of( "start-owner", "1990", null, "an owner", + expandResults( OS, SO, OD, ODS ), expandResults( D, DO, DOS, S, O ) ); + static Arguments start = Arguments.of("start", "1990", null, null, expandResults(D, DO, DOS, S, SO ), + expandResults(OD, ODS, O, OS ) ); + static Arguments owner = Arguments.of("owner", null, null, "an owner", expandResults( O, OD, ODS, OS ), +expandResults( DO, DOS, S, D, SO ) ); + static Arguments nada = Arguments.of("nada", null, null, null, expandResults( D, DO, DOS, S, SO ), + expandResults( OD, ODS, O, OS ) ); + + + + public static Stream<Arguments> parameterProvider() { + return Stream.of( startStopOwner, startOwner, start, owner, nada); } - private static Object[] expandResults(Object[] source) { - Object[] result = new Object[6]; - result[0] = source[0]; - result[1] = source[1]; - result[2] = source[2]; - result[3] = source[3]; - + private static String[][] expandResults( String[]...args) { List<String[]> arry = new ArrayList<>(); for (String pfx : prefix) { - Arrays.stream((String[][]) source[4]).map(origin -> new String[] { pfx + origin[0], pfx + origin[1] }) - .forEach(arry::add); - } - result[4] = arry.toArray(new String[arry.size()][2]); - arry.clear(); - - for (String pfx : prefix) { - Arrays.stream((String[][]) source[5]).map(origin -> new String[] { pfx + origin[0], pfx + origin[1] }) - .forEach(arry::add); + Arrays.stream(args).map(origin -> new String[] { pfx + origin[0], pfx + origin[1] }) + .forEach(arry::add); } - result[5] = arry.toArray(new String[arry.size()][2]); - return result; + return arry.toArray(new String[arry.size()][2]); } + +// private static Arguments expandResults(String name, String startDate, String endDate, String owner, Review Comment: pls remove old methods as commented-out code will never be removed again ... thx -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@creadur.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org