0
interface MyInterface {}
static class ImplA implements MyInterface {}
static class ImplB implements MyInterface {}
class OuterTests {
@ParameterizedTest
@MethodSource("myInterfaceProvider")
void test(MyInterface myInterface) {}
static Stream<MyInterface> myInterfaceProvider() {
return Stream.of(new ImplA(), new ImplB());
}
@Nested
class InnerTests{
@Test
void nestedTest() {
//how to access myInterface:MyInterface?
}
}
}
を、なぜそれをメンバーに入れていませんか? – Mzf
確かに、それはうまくいくでしょう。しかし、どのように/そのメンバーが設定されていますか? – cnmuc
フィールド注入には@Parameterを使うことができます。もっとたくさんの例を見てください:https://github.com/junit-team/junit4/wiki/parameterized-testsもし完全な例を与えることができたら – Mzf