Fix tests: use direct int buffers where needed, it's Implicit and not Explicit, the class 5 is known.
Setting devHandle or buffer to NULL in Transfer is not supported (doesn't make sense at all...).
This commit is contained in:
parent
8967434994
commit
b3e261f050
@ -21,6 +21,7 @@ import java.nio.LongBuffer;
|
||||
import org.junit.Test;
|
||||
|
||||
import de.ailis.usb4java.libusb.mocks.PollfdListenerMock;
|
||||
import de.ailis.usb4java.utils.BufferUtils;
|
||||
|
||||
/**
|
||||
* Tests the {@link LibUsb} class.
|
||||
@ -796,7 +797,7 @@ public class LibUSBTest
|
||||
{
|
||||
assumeUsbTestsEnabled();
|
||||
final Context context = new Context();
|
||||
LibUsb.handleEventsTimeoutCompleted(context, 53, IntBuffer.allocate(1));
|
||||
LibUsb.handleEventsTimeoutCompleted(context, 53, BufferUtils.allocateIntBuffer());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -832,7 +833,7 @@ public class LibUSBTest
|
||||
{
|
||||
assumeUsbTestsEnabled();
|
||||
final Context context = new Context();
|
||||
LibUsb.handleEventsCompleted(context, IntBuffer.allocate(1));
|
||||
LibUsb.handleEventsCompleted(context, BufferUtils.allocateIntBuffer());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -122,8 +122,17 @@ public class TransferTest
|
||||
assertNotSame(handle, transfer.devHandle());
|
||||
assertNotEquals(handle2, transfer.devHandle());
|
||||
assertEquals(handle, transfer.devHandle());
|
||||
transfer.setDevHandle(null);
|
||||
assertNull(transfer.devHandle());
|
||||
|
||||
try
|
||||
{
|
||||
transfer.setDevHandle(null);
|
||||
fail("Setting devHandle to null should throw IllegalArgumentException");
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
// Expected behavior
|
||||
}
|
||||
|
||||
LibUsb.freeTransfer(transfer);
|
||||
}
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ public class DescriptorUtilsTest
|
||||
{
|
||||
assertEquals("Data", DescriptorUtils.getUsageTypeName(0));
|
||||
assertEquals("Feedback", DescriptorUtils.getUsageTypeName(16));
|
||||
assertEquals("Explicit Feedback Data",
|
||||
assertEquals("Implicit Feedback Data",
|
||||
DescriptorUtils.getUsageTypeName(32));
|
||||
assertEquals("Reserved", DescriptorUtils.getUsageTypeName(48));
|
||||
}
|
||||
@ -85,7 +85,7 @@ public class DescriptorUtilsTest
|
||||
assertEquals("Bulk", DescriptorUtils.getTransferTypeName(2));
|
||||
assertEquals("Interrupt", DescriptorUtils.getTransferTypeName(3));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests the {@link DescriptorUtils#getUSBClassName(int)} method.
|
||||
*/
|
||||
@ -178,7 +178,7 @@ public class DescriptorUtilsTest
|
||||
(byte) 7, (byte) 8, (byte) 9, (byte) 10, (byte) 11, (byte) 12,
|
||||
(byte) 13), "Manufacturer", "Product", "Serial"));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests the
|
||||
* {@link DescriptorUtils#dump(javax.usb.UsbConfigurationDescriptor)}
|
||||
@ -248,7 +248,7 @@ public class DescriptorUtilsTest
|
||||
(byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 0x20,
|
||||
(byte) 7)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests the {@link DescriptorUtils#dump(javax.usb.UsbInterfaceDescriptor)}
|
||||
* method.
|
||||
@ -262,7 +262,7 @@ public class DescriptorUtilsTest
|
||||
+ " bInterfaceNumber 2\n"
|
||||
+ " bAlternateSetting 3\n"
|
||||
+ " bNumEndpoints 4\n"
|
||||
+ " bInterfaceClass 5 Unknown\n"
|
||||
+ " bInterfaceClass 5 Physical\n"
|
||||
+ " bInterfaceSubClass 6\n"
|
||||
+ " bInterfaceProtocol 7\n"
|
||||
+ " iInterface 8",
|
||||
@ -312,7 +312,7 @@ public class DescriptorUtilsTest
|
||||
DescriptorUtils.dump(new SimpleUsbEndpointDescriptor((byte) 0,
|
||||
(byte) 1, (byte) 0x82, (byte) 3, (byte) 4, (byte) 5)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ensure constructor is private.
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user