Skip to content

Commit

Permalink
re-enable tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sebersole committed Mar 19, 2021
1 parent cc10559 commit 6d49d1c
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 125 deletions.
@@ -0,0 +1,11 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/

/**
* Internal utility classes
*/
package org.hibernate.internal.util;

This file was deleted.

This file was deleted.

@@ -0,0 +1,12 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/

/**
* Tests for various "internal" aspects of Hibernate, especially centered
* around its {@link org.hibernate.internal.util} package
*/
package org.hibernate.orm.test.internal;
@@ -1,11 +1,14 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.internal.util;
package org.hibernate.orm.test.internal.utils;

import org.hibernate.internal.util.MathHelper;

import org.junit.Assert;
import org.junit.Test;

import static org.junit.Assert.*;
Expand All @@ -17,7 +20,7 @@ public class MathHelperTest {

@Test
public void ceilingPowerOfTwo() {
assertEquals( 1, MathHelper.ceilingPowerOfTwo( 1 ) );
Assert.assertEquals( 1, MathHelper.ceilingPowerOfTwo( 1 ) );
assertEquals( 2, MathHelper.ceilingPowerOfTwo( 2 ) );
assertEquals( 4, MathHelper.ceilingPowerOfTwo( 3 ) );
assertEquals( 4, MathHelper.ceilingPowerOfTwo( 4 ) );
Expand Down
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.internal.util;
package org.hibernate.orm.test.internal.utils;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
Expand All @@ -13,7 +13,8 @@
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.boot.spi.SessionFactoryOptions;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.internal.util.hib3rnat3.C0nst4nts३;
import org.hibernate.internal.util.ReflectHelper;
import org.hibernate.orm.test.internal.utils.hib3rnat3.C0nst4nts३;
import org.hibernate.service.spi.ServiceRegistryImplementor;

import org.hibernate.testing.TestForIssue;
Expand All @@ -23,8 +24,8 @@
import org.mockito.Mockito;

import static java.lang.Integer.valueOf;
import static org.hibernate.internal.util.ReflectHelperTest.Status.OFF;
import static org.hibernate.internal.util.ReflectHelperTest.Status.ON;
import static org.hibernate.orm.test.internal.utils.ReflectHelperTest.Status.OFF;
import static org.hibernate.orm.test.internal.utils.ReflectHelperTest.Status.ON;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
Expand Down Expand Up @@ -171,8 +172,8 @@ public void test_getConstantValue_outerEnum() {
public void test_getConstantValue_enumClass() {
when( sessionFactoryOptionsMock.isConventionalJavaConstants() ).thenReturn( true );

when( classLoaderServiceMock.classForName( "org.hibernate.internal.util.ReflectHelperTest$Status" ) ).thenReturn( (Class) Status.class );
Object value = ReflectHelper.getConstantValue( "org.hibernate.internal.util.ReflectHelperTest$Status", sessionFactoryImplementorMock);
when( classLoaderServiceMock.classForName( "org.hibernate.orm.test.internal.utils.ReflectHelperTest$Status" ) ).thenReturn( (Class) Status.class );
Object value = ReflectHelper.getConstantValue( "org.hibernate.orm.test.internal.utils.ReflectHelperTest$Status", sessionFactoryImplementorMock);
assertNull(value);
verify(classLoaderServiceMock, never()).classForName( eq("org.hibernate.internal.util") );
}
Expand All @@ -181,20 +182,20 @@ public void test_getConstantValue_enumClass() {
public void test_getConstantValue_nestedEnum() {

when( sessionFactoryOptionsMock.isConventionalJavaConstants() ).thenReturn( true );
when( classLoaderServiceMock.classForName( "org.hibernate.internal.util.ReflectHelperTest$Status" ) ).thenReturn( (Class) Status.class );
Object value = ReflectHelper.getConstantValue( "org.hibernate.internal.util.ReflectHelperTest$Status.ON", sessionFactoryImplementorMock);
when( classLoaderServiceMock.classForName( "org.hibernate.orm.test.internal.utils.ReflectHelperTest$Status" ) ).thenReturn( (Class) Status.class );
Object value = ReflectHelper.getConstantValue( "org.hibernate.orm.test.internal.utils.ReflectHelperTest$Status.ON", sessionFactoryImplementorMock);
assertEquals( ON, value );
verify(classLoaderServiceMock, times(1)).classForName( eq("org.hibernate.internal.util.ReflectHelperTest$Status") );
verify(classLoaderServiceMock, times(1)).classForName( eq("org.hibernate.orm.test.internal.utils.ReflectHelperTest$Status") );
}

@Test
public void test_getConstantValue_constant_digits() {

when( sessionFactoryOptionsMock.isConventionalJavaConstants() ).thenReturn( true );
when( classLoaderServiceMock.classForName( "org.hibernate.internal.util.hib3rnat3.C0nst4nts३" ) ).thenReturn( (Class) C0nst4nts३.class );
Object value = ReflectHelper.getConstantValue( "org.hibernate.internal.util.hib3rnat3.C0nst4nts३.ABC_DEF", sessionFactoryImplementorMock);
when( classLoaderServiceMock.classForName( "org.hibernate.orm.test.internal.utils.hib3rnat3.C0nst4nts३" ) ).thenReturn( (Class) C0nst4nts३.class );
Object value = ReflectHelper.getConstantValue( "org.hibernate.orm.test.internal.utils.hib3rnat3.C0nst4nts३.ABC_DEF", sessionFactoryImplementorMock);
assertEquals( C0nst4nts३.ABC_DEF, value );
verify(classLoaderServiceMock, times(1)).classForName( eq("org.hibernate.internal.util.hib3rnat3.C0nst4nts३") );
verify(classLoaderServiceMock, times(1)).classForName( eq("org.hibernate.orm.test.internal.utils.hib3rnat3.C0nst4nts३") );
}

@Test
Expand Down
Expand Up @@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.internal.util.hib3rnat3;
package org.hibernate.orm.test.internal.utils.hib3rnat3;

/**
* @author Vlad Mihalcea
Expand Down

0 comments on commit 6d49d1c

Please sign in to comment.