HHH-11554 - Added test case.

This commit is contained in:
Chris Cranford 2017-03-07 09:41:59 -05:00 committed by Andrea Boriero
parent 1273aaffd6
commit 3398175ab3
1 changed files with 57 additions and 0 deletions

View File

@ -20,6 +20,7 @@ import org.junit.Test;
import org.mockito.Mockito;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
@ -38,6 +39,47 @@ public class ReflectHelperTest {
OFF
}
interface A {
Integer getId();
void setId(Integer id);
}
interface B extends A {
String getName();
}
interface C extends B {
String getData();
}
class D implements C {
@Override
public Integer getId() {
return null;
}
@Override
public void setId(Integer id) {
}
@Override
public String getName() {
return null;
}
@Override
public String getData() {
return null;
}
}
class E extends D {
}
private SessionFactoryImplementor sessionFactoryImplementorMock;
private SessionFactoryOptions sessionFactoryOptionsMock;
@ -134,4 +176,19 @@ public class ReflectHelperTest {
assertEquals( C0nst4nts३.ABC_DEF, value );
verify(classLoaderServiceMock, times(1)).classForName( eq("org.hibernate.internal.util.hib3rnat3.C0nst4nts३") );
}
@Test
public void test_getMethod_nestedInterfaces() {
assertNotNull( ReflectHelper.findGetterMethod( C.class, "id" ) );
}
@Test
public void test_getMethod_superclass() {
assertNotNull( ReflectHelper.findGetterMethod( E.class, "id" ) );
}
@Test
public void test_setMethod_nestedInterfaces() {
assertNotNull( ReflectHelper.findSetterMethod( C.class, "id", Integer.class ) );
}
}