Вы смешиваете параметры JUnit 4 и JUnit Jupiter с параметрами. В JUnit JUpiter нет тестового бегуна, конструктор остается без параметров и вы передаете параметры методу тестирования (в некотором смысле это напоминает теории JUnit 4):
public class SentenceSplitterTest {
private SentenceSplitter sentencesplitter;
private static CollectionClass collectionClass;
// Initialization of CollectionClass moved here (instead of a static block) for two
// reasons:
// 1. If the initialization fails, you can't run the test anyway - better fail
// right here that print an error and continue to the test which we
// know won't work
// 2. It just looks neater
@BeforeAll
public static void initializeCollectionClass() throws IOException {
collectionClass = new CollectionClass();
}
@Before
public void initializeSentenceSplitter() throws IOException {
sentencesplitter = new SentenceSplitter();
}
@ParameterizedTest
@MethodSource("data")
public void testSentenceSplitterTest(DataStructure ds) {
String input = ds.string;
List<String> output = ds.listOfString;
assertEquals(output, sentencesplitter.sentenceSplit(input));
}
public static Stream<DataStructure> data() {
return collectionClass.getContent().stream();
}
}
Если это помогает, вот решение в конфигурации веб-пакета:
const babelSettings = {
extends: path.join(__dirname, "./.babelrc")
};
...
rules: [
{
test: /\.(js|jsx)$/,
use: ["babel-loader?" + JSON.stringify(babelSettings)],