Added Unit Tests for ReflectUtil.

Signed-off-by: Michael Hausegger <hausegger.michael@googlemail.com>
This commit is contained in:
Michael Hausegger 2019-05-29 17:09:45 +02:00
parent 8548a49200
commit 564ac4a2d3
1 changed files with 14 additions and 0 deletions

View File

@ -18,11 +18,13 @@
package org.eclipse.jetty.websocket.common.util;
import org.eclipse.jetty.io.AbstractConnection;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit tests for class {@link ReflectUtils}.
@ -68,6 +70,18 @@ public class ReflectUtilsTest
assertFalse(ReflectUtils.isDefaultConstructable(Integer.class));
}
@Test
public void testIsDefaultConstructableWithAbstractClass()
{
assertFalse(ReflectUtils.isDefaultConstructable(AbstractConnection.class));
}
@Test
public void testIsDefaultConstructableWithObjectClass()
{
assertTrue(ReflectUtils.isDefaultConstructable(Object.class));
}
@Test
public void testFindGenericClassForStringClassTwice()
{