0

I try to use CDI with JUnit. I saw lot of example that implement a custom Runner that uses non-static methods. But i have one more constraint. I use the Cucumber runner on top of JUnit and selenium. So i can't use the BlockJUnit4ClassRunner. I must use the Cucumber Runner.

Any Idea

Scandinave
  • 1,388
  • 1
  • 17
  • 41
  • what about Mockito.@InjectMocks? – Vogel612 Sep 14 '15 at 10:52
  • I don't think. The problem is JUnit that use static Method, Inside this method i can just use static class member. But i can't inject something into static member. – Scandinave Sep 14 '15 at 11:28
  • I daresay you shouldn't rely on `@BeforeClass` for CDI. Instead you should run CDI when you reset your class under test in `@Before`, which is not a static method. – Vogel612 Sep 14 '15 at 11:33
  • Yes, but i need to load some data that are common to all test in a suite. So i need to use @BeforeClass – Scandinave Sep 14 '15 at 12:50

0 Answers0