Fix tests to react correctly to NULL passed to free() functions.

This commit is contained in:
Luca Longinotti 2013-07-15 18:49:41 +02:00
parent c8d6f4ce49
commit 0851eb7a32
2 changed files with 13 additions and 2 deletions

View File

@ -917,7 +917,7 @@ public class LibUSBDeviceTest
* Tests the {@link LibUsb#freeConfigDescriptor(ConfigDescriptor)} method
* without a descriptor.
*/
@Test(expected = IllegalArgumentException.class)
@Test
public void testFreeConfigDescriptorWithoutDescriptor()
{
assumeUsbTestsEnabled();

View File

@ -273,7 +273,7 @@ public class LibUSBTest
* Tests {@link LibUsb#freeDeviceList(DeviceList, boolean)} method without
* list.
*/
@Test(expected = IllegalArgumentException.class)
@Test
public void testFreeDeviceListWithoutList()
{
assumeUsbTestsEnabled();
@ -638,6 +638,17 @@ public class LibUSBTest
LibUsb.freeConfigDescriptor(new ConfigDescriptor());
}
/**
* Tests the {@link LibUsb#freeConfigDescriptor(ConfigDescriptor)} method
* with null parameter. Must do nothing.
*/
@Test
public void testFreeConfigDescriptorWithNull()
{
assumeUsbTestsEnabled();
LibUsb.freeConfigDescriptor(null);
}
/**
* Tests the
* {@link LibUsb#getSsEndpointCompanionDescriptor(Context, EndpointDescriptor, SsEndpointCompanionDescriptor)}