-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathInterfaceTest.java
More file actions
71 lines (63 loc) · 1.46 KB
/
InterfaceTest.java
File metadata and controls
71 lines (63 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* Copyright (C) 2013 Klaus Reimer <[email protected]>
* 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.Interface;
import org.usb4java.LibUsb;
/**
* Tests the {@link Interface} class.
*
* @author Klaus Reimer ([email protected])
*/
public class InterfaceTest
{
/** The test subject. */
private Interface descriptor;
/**
* Setup test.
*/
@Before
public void setUp()
{
if (isUsbTestsEnabled())
{
LibUsb.init(null);
this.descriptor = new Interface();
}
}
/**
* Tear down test.
*/
@After
public void tearDown()
{
if (isUsbTestsEnabled())
{
LibUsb.exit(null);
}
}
/**
* Tests uninitialized access to {@link Interface#altsetting()}
*/
@Test(expected = IllegalStateException.class)
public void testUninitializedAltsetting()
{
assumeUsbTestsEnabled();
this.descriptor.altsetting();
}
/**
* Tests uninitialized access to {@link Interface#numAltsetting()}
*/
@Test(expected = IllegalStateException.class)
public void testUninitializedDescriptorType()
{
assumeUsbTestsEnabled();
this.descriptor.numAltsetting();
}
}