0
私はcdiユニットライブラリを使用してクラスをテストします。 Testクラス:CDI、cdi-unit。例外を試みるインターフェイス
@RunWith(CdiRunner.class)
public class IAktResponseMapperTest {
@Inject
private ITestCDI testCDI;
@Test
public void testCDI(){
testCDI.testCDI();
}
}
ITestCDIインタフェース:
public interface ITestCDI {
void testCDI();
}
TestCDIクラス:
@ApplicationScoped
public class TestCDI implements ITestCDI {
public void testCDI() {
System.out.println("testCDI");
}
}
だから、私はエラーを取得し、このテストを実行している:
org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type ITestCDI with qualifiers @Default
at injection point [UnbackedAnnotatedField] @Inject private ru.nwth.pio.personal_area.accounting.mapper.IAktResponseMapperTest.testCDI
at ru.nwth.pio.personal_area.accounting.mapper.IAktResponseMapperTest.testCDI(IAktResponseMapperTest.java:0)
しかし、私の場合TestCDI claを注入するインタフェースITestCDIの代わりに直接ss、それはいいです。インターフェイスを動作させるにはどうすればよいですか?手伝ってくれてありがとう!