From ca7a1e284f0ec1bf1de62062bc87ad1204c37ecd Mon Sep 17 00:00:00 2001 From: Hardy Ferentschik Date: Mon, 1 Aug 2011 15:47:49 +0200 Subject: [PATCH] HHH-6393 Making the name of the test classes consistent --- .../attribute/MappedAttribute.java | 3 - .../entity/EmbeddableBindingTest.java | 1 - ...beddedIdTests.java => EmbeddedIdTest.java} | 2 +- .../entity/EnumeratedBindingTest.java | 106 +++++++++++++++++ .../entity/EnumeratedBindingTests.java | 107 ------------------ ...Tests.java => SynchronizeBindingTest.java} | 2 +- .../annotations/entity/TableNameTest.java | 1 - ...ingTests.java => TemporalBindingTest.java} | 8 +- 8 files changed, 112 insertions(+), 118 deletions(-) rename hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/{EmbeddedIdTests.java => EmbeddedIdTest.java} (97%) create mode 100644 hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/EnumeratedBindingTest.java delete mode 100644 hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/EnumeratedBindingTests.java rename hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/{SynchronizeBindingTests.java => SynchronizeBindingTest.java} (96%) rename hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/{TemporalBindingTests.java => TemporalBindingTest.java} (92%) diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/attribute/MappedAttribute.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/attribute/MappedAttribute.java index b19d544005..6daa25d2f5 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/attribute/MappedAttribute.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/attribute/MappedAttribute.java @@ -107,9 +107,6 @@ public abstract class MappedAttribute implements Comparable { sb.append( '}' ); return sb.toString(); } - - - } diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/EmbeddableBindingTest.java b/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/EmbeddableBindingTest.java index d4668242b1..a0d9f2db64 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/EmbeddableBindingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/EmbeddableBindingTest.java @@ -42,7 +42,6 @@ import static junit.framework.Assert.assertTrue; * * @author Hardy Ferentschik */ - public class EmbeddableBindingTest extends BaseAnnotationBindingTestCase { @Test @Resources(annotatedClasses = { User.class, Address.class }) diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/EmbeddedIdTests.java b/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/EmbeddedIdTest.java similarity index 97% rename from hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/EmbeddedIdTests.java rename to hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/EmbeddedIdTest.java index 91635135fa..e577ffb79d 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/EmbeddedIdTests.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/EmbeddedIdTest.java @@ -45,7 +45,7 @@ import static junit.framework.Assert.assertTrue; * @author Strong Liu */ @FailureExpected(jiraKey = "HHH-6447", message = "Work in progress") -public class EmbeddedIdTests extends BaseAnnotationBindingTestCase { +public class EmbeddedIdTest extends BaseAnnotationBindingTestCase { @Test // @Resources(annotatedClasses = { User.class, Address.class }) public void testEmbeddable() { diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/EnumeratedBindingTest.java b/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/EnumeratedBindingTest.java new file mode 100644 index 0000000000..9049e08c60 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/EnumeratedBindingTest.java @@ -0,0 +1,106 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * Copyright (c) 2011, Red Hat Inc. or third-party contributors as + * indicated by the @author tags or express copyright attribution + * statements applied by the authors. All third-party contributions are + * distributed under license by Red Hat Inc. + * + * This copyrighted material is made available to anyone wishing to use, modify, + * copy, or redistribute it subject to the terms and conditions of the GNU + * Lesser General Public License, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this distribution; if not, write to: + * Free Software Foundation, Inc. + * 51 Franklin Street, Fifth Floor + * Boston, MA 02110-1301 USA + */ + +package org.hibernate.metamodel.source.annotations.entity; + +import java.sql.Types; +import java.util.Date; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.Id; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.junit.Test; + +import org.hibernate.metamodel.binding.AttributeBinding; +import org.hibernate.metamodel.binding.EntityBinding; +import org.hibernate.metamodel.binding.HibernateTypeDescriptor; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; + +/** + * @author Strong Liu + */ +public class EnumeratedBindingTest extends BaseAnnotationBindingTestCase { + @Entity + class Item { + @Id + long id; + @Temporal(TemporalType.TIMESTAMP) + Date orderDate; + String name; + @Enumerated(EnumType.STRING) + OrderType orderType; + CustomerType customerType; + } + + enum CustomerType { + PROGRAMMER, BOSS; + } + + enum OrderType { + B2C, C2C, MAIL, DIRECT; + } + + @Test + @Resources(annotatedClasses = Item.class) + public void testEnumeratedTypeAttribute() { + EntityBinding binding = getEntityBinding( Item.class ); + + AttributeBinding attributeBinding = binding.locateAttributeBinding( "customerType" ); + HibernateTypeDescriptor descriptor = attributeBinding.getHibernateTypeDescriptor(); + assertEquals( org.hibernate.type.EnumType.class.getName(), descriptor.getExplicitTypeName() ); + assertEquals( CustomerType.class.getName(), descriptor.getJavaTypeName() ); + assertNotNull( descriptor.getResolvedTypeMapping() ); + assertFalse( descriptor.getTypeParameters().isEmpty() ); + assertEquals( + CustomerType.class.getName(), + descriptor.getTypeParameters().get( org.hibernate.type.EnumType.ENUM ) + ); + assertEquals( + String.valueOf( Types.INTEGER ), + descriptor.getTypeParameters().get( org.hibernate.type.EnumType.TYPE ) + ); + + + attributeBinding = binding.locateAttributeBinding( "orderType" ); + descriptor = attributeBinding.getHibernateTypeDescriptor(); + assertEquals( org.hibernate.type.EnumType.class.getName(), descriptor.getExplicitTypeName() ); + assertEquals( OrderType.class.getName(), descriptor.getJavaTypeName() ); + assertNotNull( descriptor.getResolvedTypeMapping() ); + assertFalse( descriptor.getTypeParameters().isEmpty() ); + assertEquals( + OrderType.class.getName(), + descriptor.getTypeParameters().get( org.hibernate.type.EnumType.ENUM ) + ); + assertEquals( + String.valueOf( Types.VARCHAR ), + descriptor.getTypeParameters().get( org.hibernate.type.EnumType.TYPE ) + ); + } +} diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/EnumeratedBindingTests.java b/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/EnumeratedBindingTests.java deleted file mode 100644 index 7753fd8da4..0000000000 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/EnumeratedBindingTests.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * Copyright (c) 2011, Red Hat Inc. or third-party contributors as - * indicated by the @author tags or express copyright attribution - * statements applied by the authors. All third-party contributions are - * distributed under license by Red Hat Inc. - * - * This copyrighted material is made available to anyone wishing to use, modify, - * copy, or redistribute it subject to the terms and conditions of the GNU - * Lesser General Public License, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this distribution; if not, write to: - * Free Software Foundation, Inc. - * 51 Franklin Street, Fifth Floor - * Boston, MA 02110-1301 USA - */ - -package org.hibernate.metamodel.source.annotations.entity; - -import java.sql.Types; -import java.util.Date; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.Id; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; - -import org.junit.Test; - -import org.hibernate.metamodel.binding.AttributeBinding; -import org.hibernate.metamodel.binding.EntityBinding; -import org.hibernate.metamodel.binding.HibernateTypeDescriptor; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; - -/** - * @author Strong Liu - */ -public class EnumeratedBindingTests extends BaseAnnotationBindingTestCase { - @Entity - class Item { - @Id - long id; - @Temporal(TemporalType.TIMESTAMP) - Date orderDate; - String name; - @Enumerated(EnumType.STRING) - OrderType orderType; - CustomerType customerType; - } - - enum CustomerType { - PROGRAMMER, BOSS; - } - - enum OrderType { - B2C, C2C, MAIL, DIRECT; - } - - @Test - @Resources(annotatedClasses = Item.class) - public void testEnumeratedTypeAttribute() { - EntityBinding binding = getEntityBinding( Item.class ); - - AttributeBinding attributeBinding = binding.locateAttributeBinding( "customerType" ); - HibernateTypeDescriptor descriptor = attributeBinding.getHibernateTypeDescriptor(); - assertEquals( org.hibernate.type.EnumType.class.getName(), descriptor.getExplicitTypeName() ); - assertEquals( CustomerType.class.getName(), descriptor.getJavaTypeName() ); - assertNotNull( descriptor.getResolvedTypeMapping() ); - assertFalse( descriptor.getTypeParameters().isEmpty() ); - assertEquals( - CustomerType.class.getName(), - descriptor.getTypeParameters().get( org.hibernate.type.EnumType.ENUM ) - ); - assertEquals( - String.valueOf( Types.INTEGER ), - descriptor.getTypeParameters().get( org.hibernate.type.EnumType.TYPE ) - ); - - - attributeBinding = binding.locateAttributeBinding( "orderType" ); - descriptor = attributeBinding.getHibernateTypeDescriptor(); - assertEquals( org.hibernate.type.EnumType.class.getName(), descriptor.getExplicitTypeName() ); - assertEquals( OrderType.class.getName(), descriptor.getJavaTypeName() ); - assertNotNull( descriptor.getResolvedTypeMapping() ); - assertFalse( descriptor.getTypeParameters().isEmpty() ); - assertEquals( - OrderType.class.getName(), - descriptor.getTypeParameters().get( org.hibernate.type.EnumType.ENUM ) - ); - assertEquals( - String.valueOf( Types.VARCHAR ), - descriptor.getTypeParameters().get( org.hibernate.type.EnumType.TYPE ) - ); - } - -} diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/SynchronizeBindingTests.java b/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/SynchronizeBindingTest.java similarity index 96% rename from hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/SynchronizeBindingTests.java rename to hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/SynchronizeBindingTest.java index 4a748aed99..04bf0ec8a9 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/SynchronizeBindingTests.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/SynchronizeBindingTest.java @@ -40,7 +40,7 @@ import static junit.framework.Assert.assertTrue; * * @author Hardy Ferentschik */ -public class SynchronizeBindingTests extends BaseAnnotationBindingTestCase { +public class SynchronizeBindingTest extends BaseAnnotationBindingTestCase { @Test @Resources(annotatedClasses = TestEntityWithSynchronizeAnnotation.class) public void testSynchronizeAnnotation() { diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/TableNameTest.java b/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/TableNameTest.java index d7faf047e2..eb31eb09b9 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/TableNameTest.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/TableNameTest.java @@ -40,7 +40,6 @@ import static junit.framework.Assert.assertEquals; * @author Hardy Ferentschik */ public class TableNameTest extends BaseAnnotationBindingTestCase { - @Entity class A { @Id diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/TemporalBindingTests.java b/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/TemporalBindingTest.java similarity index 92% rename from hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/TemporalBindingTests.java rename to hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/TemporalBindingTest.java index eb58b98ebf..b85b6c9d32 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/TemporalBindingTests.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/entity/TemporalBindingTest.java @@ -44,7 +44,7 @@ import static org.junit.Assert.assertTrue; /** * @author Strong Liu */ -public class TemporalBindingTests extends BaseAnnotationBindingTestCase { +public class TemporalBindingTest extends BaseAnnotationBindingTestCase { @Entity class Item1 { @Id @@ -53,7 +53,7 @@ public class TemporalBindingTests extends BaseAnnotationBindingTestCase { } @Test(expected = AnnotationException.class) - @Resources(annotatedClasses = TemporalBindingTests.Item1.class) + @Resources(annotatedClasses = TemporalBindingTest.Item1.class) public void testNoTemporalAnnotationOnTemporalTypeAttribute() { getEntityBinding( Item1.class ); @@ -68,7 +68,7 @@ public class TemporalBindingTests extends BaseAnnotationBindingTestCase { } @Test - @Resources(annotatedClasses = TemporalBindingTests.Item2.class) + @Resources(annotatedClasses = TemporalBindingTest.Item2.class) public void testTemporalTypeAttribute() { EntityBinding binding = getEntityBinding( Item2.class ); AttributeBinding attributeBinding = binding.locateAttributeBinding( "date" ); @@ -89,7 +89,7 @@ public class TemporalBindingTests extends BaseAnnotationBindingTestCase { } @Test - @Resources(annotatedClasses = TemporalBindingTests.Item3.class) + @Resources(annotatedClasses = TemporalBindingTest.Item3.class) public void testTemporalTypeAsId() { EntityBinding binding = getEntityBinding( Item3.class ); AttributeBinding attributeBinding = binding.locateAttributeBinding( "date" );