I am trying to use argument capture to determine what arguments are being passed to a mocked Mockito method, but I am not able to capture any values.
class CombinedEvent 
{
   final List<String> events;
   public CombinedEvent() {
      this.events = new ArrayList<>();
      this.events.add("WATCHITM");
      this.events.add("BIDITEM");
   }
}
Holder class
class CombinedNotificationAdapter {
    private CombinedEvent combinedEvent;
     CombinedNotificationAdapter() {
        this.combinedEvent  = new CombinedEvent();
     }
     public boolean isEnabled(String user, NotificationPreferenceManager preferenceManager) {
         boolean status = true;
         for (String event : combinedEvent.events) {
            status = status && preferenceManager.isEventEnabled(user, event);
         }
         return status;
     }
}
My unit test
@RunWith(JUnit4.class)
class CombinedNotificationAdapterTest {
   private CombinedNotificationAdapter adapter;
   @Mock
   private NotificationPreferenceManager preferenceManager;
   @Before
   public void setUp() {
       MockitoAnnotations.initMocks(this);
       adapter = new CombinedNotificationAdapter();
   }
   @Test
   public void testIsEnabled() {
      doReturn(true).when(preferenceManager).isEventEnabled(eq("test"), anyString());
      Assert.assertTrue(adapter.isEnabled("test", preferenceManager));
      ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
       verify(preferenceManager, times(2)).isEventEnabled(eq("test"), captor.capture());
       System.out.println(captor.getAllValues());
   }
}
The output of captor.getAllValues() is an empty list. I would like the values to return a list of WATCHITM and BIDITEM.  I don't know what I am going wrong.
Reference:
 
    