I am wondering how i am doing tests with CDI. and mocking classes during injection.
if i have the class:
@Named
@RequestScoped
public class ItemProcessor {
@Inject
private ItemDao itemDao;
public void execute() {
List<Item> items = itemDao.fetchItems();
for (Item item : items) {
System.out.println("Found item " + item);
}
}
}
How do i do if i want to mock the ItemDao class during test, when i want to test My ItemProcessor ?