HHH-14762 Testsuite: Assert.notNull must not be used on primitive types

Fix https://hibernate.atlassian.net/browse/HHH-14762
This commit is contained in:
boris-unckel 2021-07-29 09:43:52 +02:00 committed by Andrea Boriero
parent fb62f9611a
commit e1b82b005c
5 changed files with 7 additions and 6 deletions

View File

@ -11,6 +11,7 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import org.hibernate.bytecode.internal.bytebuddy.BasicProxyFactoryImpl; import org.hibernate.bytecode.internal.bytebuddy.BasicProxyFactoryImpl;
import org.hibernate.bytecode.internal.bytebuddy.ByteBuddyState; import org.hibernate.bytecode.internal.bytebuddy.ByteBuddyState;
@ -27,7 +28,7 @@ public class ByteBuddyBasicProxyFactoryTest {
Object entityProxy = BASIC_PROXY_FACTORY.getProxy(); Object entityProxy = BASIC_PROXY_FACTORY.getProxy();
assertTrue( entityProxy.equals( entityProxy ) ); assertTrue( entityProxy.equals( entityProxy ) );
assertNotNull( entityProxy.hashCode() ); assertNotEquals(0, entityProxy.hashCode() );
Object otherEntityProxy = BASIC_PROXY_FACTORY.getProxy(); Object otherEntityProxy = BASIC_PROXY_FACTORY.getProxy();
assertFalse( entityProxy.equals( otherEntityProxy ) ); assertFalse( entityProxy.equals( otherEntityProxy ) );

View File

@ -278,7 +278,7 @@ public class JPAXMLOverriddenAnnotationReaderTest extends BaseUnitTestCase {
field = BusTripPk.class.getDeclaredField( "busDriver" ); field = BusTripPk.class.getDeclaredField( "busDriver" );
reader = new JPAXMLOverriddenAnnotationReader( field, context, BootstrapContextImpl.INSTANCE ); reader = new JPAXMLOverriddenAnnotationReader( field, context, BootstrapContextImpl.INSTANCE );
assertNotNull( reader.isAnnotationPresent( Basic.class ) ); assertTrue( reader.isAnnotationPresent( Basic.class ) );
} }
@Test @Test

View File

@ -66,7 +66,7 @@ public class StaticMetadataTest {
// Cat (hierarchy) // Cat (hierarchy)
assertNotNull( Cat_.id ); assertNotNull( Cat_.id );
assertNotNull( Cat_.id.isId() ); assertTrue( Cat_.id.isId() );
assertEquals( Animal.class, Cat_.id.getJavaMember().getDeclaringClass() ); assertEquals( Animal.class, Cat_.id.getJavaMember().getDeclaringClass() );
assertNotNull( Cat_.nickname ); assertNotNull( Cat_.nickname );

View File

@ -61,8 +61,8 @@ public class BasicTypeColumnDefinitionTest extends BaseEnversJPAFunctionalTestCa
@Priority(10) @Priority(10)
public void testMetadataBindings() { public void testMetadataBindings() {
final Long expectedDefaultLength = new Long( DEFAULT_LENGTH ); final Long expectedDefaultLength = new Long( DEFAULT_LENGTH );
final Long expectedDefaultPrecision = new Long( DEFAULT_PRECISION ); final Integer expectedDefaultPrecision = Integer.valueOf( DEFAULT_PRECISION );
final Long expectedDefaultScale = new Long( DEFAULT_SCALE ); final Integer expectedDefaultScale = Integer.valueOf( DEFAULT_SCALE );
final Table auditTable = metadata().getEntityBinding( BasicTypeContainer.class.getName() + "_AUD" ).getTable(); final Table auditTable = metadata().getEntityBinding( BasicTypeContainer.class.getName() + "_AUD" ).getTable();

View File

@ -72,6 +72,6 @@ public class EmbeddableWithDeclaredDataTest extends BaseEnversJPAFunctionalTestC
// only value.codeArt should be audited because it is the only audited field in EmbeddableWithDeclaredData; // only value.codeArt should be audited because it is the only audited field in EmbeddableWithDeclaredData;
// fields in AbstractEmbeddable should not be audited. // fields in AbstractEmbeddable should not be audited.
Assert.assertEquals( entityLoaded.getValue().getCodeart(), entityRev1.getValue().getCodeart() ); Assert.assertEquals( entityLoaded.getValue().getCodeart(), entityRev1.getValue().getCodeart() );
Assert.assertNull( entityRev1.getValue().getCode() ); Assert.assertEquals(0, entityRev1.getValue().getCode() );
} }
} }