package com.github.vbauer.houdini.util;

import com.github.vbauer.houdini.core.BasicTest;
import org.junit.Assert;
import org.junit.Test;

/**
 * @author Vladislav Bauer 
 */

public class ReflectionUtilsTest extends BasicTest {

    @Test
    public void testGetClassWithoutProxies() {
        Assert.assertNull(ReflectionUtils.getClassWithoutProxies(null));
        Assert.assertEquals(Object.class, ReflectionUtils.getClassWithoutProxies(new Object()));
        Assert.assertEquals(String.class, ReflectionUtils.<String>getClassWithoutProxies("test"));
    }

    @Test
    public void testGetClassesWithoutProxies() {
        Assert.assertEquals(0, ReflectionUtils.getClassesWithoutProxies(null).length);
        Assert.assertEquals(0, ReflectionUtils.getClassesWithoutProxies(new Object[]{}).length);
    }

    @Test
    public void testConstructorContract() throws Exception {
        checkUtilConstructorContract(ReflectionUtils.class);
    }

}

@@ -132,16 +132,124 @@
 .Test;%0A%0A
+import java.lang.reflect.InvocationTargetException;%0Aimport java.lang.reflect.UndeclaredThrowableException;%0A%0A
 /**%0A * @
@@ -1053,10 +1053,1660 @@
 %0A    %7D%0A%0A
+    @Test(expected = IllegalStateException.class)%0A    public void testHandleReflectionException1() %7B%0A        ReflectionUtils.handleReflectionException(new NoSuchMethodException());%0A    %7D%0A%0A    @Test(expected = IllegalStateException.class)%0A    public void testHandleReflectionException2() %7B%0A        ReflectionUtils.handleReflectionException(new IllegalAccessException());%0A    %7D%0A%0A    @Test(expected = RuntimeException.class)%0A    public void testHandleReflectionException3() %7B%0A        ReflectionUtils.handleReflectionException(new RuntimeException());%0A    %7D%0A%0A    @Test(expected = UndeclaredThrowableException.class)%0A    public void testHandleReflectionException4() %7B%0A        ReflectionUtils.handleReflectionException(new Exception());%0A    %7D%0A%0A    @Test(expected = Error.class)%0A    public void testHandleReflectionException5() %7B%0A        ReflectionUtils.handleReflectionException(new InvocationTargetException(new Error()));%0A    %7D%0A%0A    @Test(expected = RuntimeException.class)%0A    public void testRethrowRuntimeException1() %7B%0A        ReflectionUtils.rethrowRuntimeException(new RuntimeException());%0A    %7D%0A%0A    @Test(expected = Error.class)%0A    public void testRethrowRuntimeException2() %7B%0A        ReflectionUtils.rethrowRuntimeException(new Error());%0A    %7D%0A%0A    @Test(expected = UndeclaredThrowableException.class)%0A    public void testRethrowRuntimeException3() %7B%0A        ReflectionUtils.rethrowRuntimeException(new Exception());%0A    %7D%0A%0A    @Test(expected = Error.class)%0A    public void testHandleInvocationTargetException() %7B%0A        ReflectionUtils.handleInvocationTargetException(%0A            new InvocationTargetException(new Error())%0A        );%0A    %7D%0A%0A
 %7D%0A

Add unit tests for ReflectionUtils