Ensure that DescriptorUtils has a private constructor
This commit is contained in:
parent
9f82bfd3fc
commit
e285eedb7c
@ -7,6 +7,7 @@ package de.ailis.usb4java.utils;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.junit.Test;
|
||||
@ -173,4 +174,19 @@ public class DescriptorUtilsTest
|
||||
DescriptorUtils.dump(new SimpleUsbEndpointDescriptor((byte) 0,
|
||||
(byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure constructor is private.
|
||||
*
|
||||
* @throws Exception
|
||||
* When constructor test fails.
|
||||
*/
|
||||
@Test
|
||||
public void testPrivateConstructor() throws Exception
|
||||
{
|
||||
assertEquals(0, DescriptorUtils.class.getConstructors().length);
|
||||
Constructor<?> c = DescriptorUtils.class.getDeclaredConstructor();
|
||||
c.setAccessible(true);
|
||||
c.newInstance();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user