Vscode-java-test: Fails to load JUnit launch configuration in @ParameterizedTest that has any parameter whose type has generic types

Created on 1 Sep 2020  路  2Comments  路  Source: microsoft/vscode-java-test

I'm using

JUnit 5.6.2
Java Test Runner 0.24.1

In the description of the extension page, it says it supports JUnit 5 (v5.1.0+)

When I click Run Test or Debug Test button above a @ParameterizedTest method that has any parameter whose type has generic parameter(s) - like List<Integer> or Map<Integer, Integer> - Java Test Runner says Error: Failed to load JUnit launch configuration. Strangely, it doesn't fail to launch tests if I click Run Test or Debug Test button above the class of @ParameterizedTest methods.

It successes in below code.

@ParameterizedTest
@MethodSource
Run Test | Debug Test // click any botton
void test(Object listObject) {
    List<Integer> list = (List<Integer>) listObject;
    ...
}

static Stream<Arguments> test() {
    return ...
}

But fails in below code.

@ParameterizedTest
@MethodSource
Run Test | Debug Test // click any botton
void test(List<Integer> list) {
    ...
}

static Stream<Arguments> test() {
    return ...
}

It doesn't even fail in below code.

Run Test | Debug Test // click any botton
public class Test{
    @ParameterizedTest
    @MethodSource
    void test(List<Integer> list) {
        ...
    }

    static Stream<Arguments> test() {
        return ...
    }
}

It doesn't even fail when you execute the test by gradle.

./gradlew.bat test --tests *Test.test
bug

All 2 comments

Seems that the parameter type of the test name should be java.util.List instead of java.util.List<java.lang.Integer>

Will make a fix later

Hotfix for this issue will release in early next week

Was this page helpful?
0 / 5 - 0 ratings