/*
* Copyright (C) 2013 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*/
package org.usb4java;
import static org.usb4java.test.UsbAssume.assumeUsbTestsEnabled;
import static org.usb4java.test.UsbAssume.isUsbTestsEnabled;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.usb4java.BosDevCapabilityDescriptor;
import org.usb4java.LibUsb;
/**
* Tests the {@link BosDevCapabilityDescriptor} class.
*
* @author Klaus Reimer (k@ailis.de)
*/
public class BosDevCapabilityDescriptorTest
{
/** The test subject. */
private BosDevCapabilityDescriptor descriptor;
/**
* Setup test.
*/
@Before
public void setUp()
{
if (isUsbTestsEnabled())
{
LibUsb.init(null);
this.descriptor = new BosDevCapabilityDescriptor();
}
}
/**
* Tear down test.
*/
@After
public void tearDown()
{
if (isUsbTestsEnabled())
{
LibUsb.exit(null);
}
}
/**
* Tests uninitialized access to
* {@link BosDevCapabilityDescriptor#bLength()}
*/
@Test(expected = IllegalStateException.class)
public void testUninitializedLength()
{
assumeUsbTestsEnabled();
this.descriptor.bLength();
}
/**
* Tests uninitialized access to
* {@link BosDevCapabilityDescriptor#bDescriptorType()}
*/
@Test(expected = IllegalStateException.class)
public void testUninitializedDescriptorType()
{
assumeUsbTestsEnabled();
this.descriptor.bDescriptorType();
}
/**
* Tests uninitialized access to
* {@link BosDevCapabilityDescriptor#bDevCapabilityType()}
*/
@Test(expected = IllegalStateException.class)
public void testUninitializedDevCapabilityType()
{
assumeUsbTestsEnabled();
this.descriptor.bDevCapabilityType();
}
/**
* Tests uninitialized access to
* {@link BosDevCapabilityDescriptor#devCapabilityData()}
*/
@Test(expected = IllegalStateException.class)
public void testUninitializedDevCapabilityData()
{
assumeUsbTestsEnabled();
this.descriptor.devCapabilityData();
}
}