If a class has methods with the same name, one is annotated with jdk.jpackage.test.Annotations.Test annotation. Others will also be executed as tests. E.g.:
class Foo {
@jdk.jpackage.test.Annotations.Test
@jdk.jpackage.test.Annotations.Parameter("1")
public void a(int v) {}
public void a() {} // jpackage test-lib will consider this method as a test, but it shouldn't
}
Another, more likely, way this error occurs is when a parameterized test function has the same name as a function supplying parameters:
class Foo {
@Test
@ParameterSupplier("testDates")
public void testDates(LocalDate v) {
}
// jpackage test-lib will consider this method as a test, but it shouldn't
public static Collection<Object[]> testDates() {
return List.of(new Object[][] {
{ LocalDate.parse("2018-05-05") },
{ LocalDate.parse("2018-07-11") },
});
}
}
This error doesn't affect existing tests. It was discovered in not yet integrated tests.
class Foo {
@jdk.jpackage.test.Annotations.Test
@jdk.jpackage.test.Annotations.Parameter("1")
public void a(int v) {}
public void a() {} // jpackage test-lib will consider this method as a test, but it shouldn't
}
Another, more likely, way this error occurs is when a parameterized test function has the same name as a function supplying parameters:
class Foo {
@Test
@ParameterSupplier("testDates")
public void testDates(LocalDate v) {
}
// jpackage test-lib will consider this method as a test, but it shouldn't
public static Collection<Object[]> testDates() {
return List.of(new Object[][] {
{ LocalDate.parse("2018-05-05") },
{ LocalDate.parse("2018-07-11") },
});
}
}
This error doesn't affect existing tests. It was discovered in not yet integrated tests.
- links to
-
Commit(master) openjdk/jdk/5cf11324
-
Review(master) openjdk/jdk/23632