*/
@Test
public void testPollFdNotifiers()
{
assumeUsbTestsEnabled();
final PollfdListenerMock listener = new PollfdListenerMock();
final Context context = new Context();
LibUsb.init(context);
LibUsb.setPollfdNotifiers(context, listener, "test");
FileDescriptor fd = new FileDescriptor();
LibUsb.triggerPollfdAdded(fd, 53, context.getPointer());
assertEquals(53, listener.addedEvents);
assertSame(fd, listener.addedFd);
assertSame("test", listener.addedUserData);
assertNull(listener.removedFd);
assertNull(listener.removedUserData);
listener.reset();
fd = new FileDescriptor();
LibUsb.triggerPollfdRemoved(fd, context.getPointer());
assertEquals(0, listener.addedEvents);
assertNull(listener.addedFd);
assertNull(listener.addedUserData);
assertSame(fd, listener.removedFd);
assertSame("test", listener.removedUserData);
LibUsb.setPollfdNotifiers(context, null, null);
listener.reset();
fd = new FileDescriptor();
LibUsb.triggerPollfdAdded(fd, 53, context.getPointer());
assertEquals(0, listener.addedEvents);
assertNull(listener.addedFd);
assertNull(listener.addedUserData);
assertNull(listener.removedFd);
assertNull(listener.removedUserData);
listener.reset();
fd = new FileDescriptor();
LibUsb.triggerPollfdRemoved(fd, context.getPointer());
assertEquals(0, listener.addedEvents);
assertNull(listener.addedFd);