mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-27 14:30:16 +00:00
HHH-12192 - Fix tests failing on PostgreSQL
This commit is contained in:
parent
e9c3870909
commit
803b29fc1a
@ -13,6 +13,7 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.PersistenceException;
|
||||
@ -37,7 +38,6 @@
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
@ -62,7 +62,7 @@ public void setUp() throws IOException, SQLException {
|
||||
|
||||
@Test
|
||||
@TestForIssue(jiraKey = "HHH-12192")
|
||||
public void testGenerateSchemaDoesNotProduceTheSameStatementTwice() throws Exception {
|
||||
public void testErrorMessageContainsTheFailingDDLCommand() {
|
||||
try {
|
||||
entityManagerFactoryBuilder.generateSchema();
|
||||
fail( "Should haave thrown IOException" );
|
||||
@ -75,7 +75,9 @@ public void testGenerateSchemaDoesNotProduceTheSameStatementTwice() throws Excep
|
||||
CommandAcceptanceException commandAcceptanceException = (CommandAcceptanceException) e.getCause()
|
||||
.getCause();
|
||||
|
||||
assertTrue( commandAcceptanceException.getMessage().contains( "drop table test_entity if exists" ) );
|
||||
boolean ddlCommandFound = Pattern.compile( "drop table( if exists)? test_entity( if exists)?" )
|
||||
.matcher( commandAcceptanceException.getMessage().toLowerCase() ).find();
|
||||
assertTrue( "The Exception Message does not contain the DDL command causing the failure", ddlCommandFound );
|
||||
|
||||
assertTrue( commandAcceptanceException.getCause() instanceof SQLException );
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.PersistenceException;
|
||||
@ -56,7 +57,7 @@ public void setUp() throws IOException {
|
||||
|
||||
@Test
|
||||
@TestForIssue(jiraKey = "HHH-12192")
|
||||
public void testGenerateSchemaDoesNotProduceTheSameStatementTwice() throws Exception {
|
||||
public void testErrorMessageContainsTheFailingDDLCommand() throws Exception {
|
||||
try {
|
||||
entityManagerFactoryBuilder.generateSchema();
|
||||
fail( "Should haave thrown IOException" );
|
||||
@ -69,7 +70,10 @@ public void testGenerateSchemaDoesNotProduceTheSameStatementTwice() throws Excep
|
||||
CommandAcceptanceException commandAcceptanceException = (CommandAcceptanceException) e.getCause()
|
||||
.getCause();
|
||||
|
||||
assertTrue( commandAcceptanceException.getMessage().contains( "drop table test_entity if exists" ) );
|
||||
|
||||
boolean ddlCommandFound = Pattern.compile( "drop table( if exists)? test_entity( if exists)?" )
|
||||
.matcher( commandAcceptanceException.getMessage().toLowerCase() ).find();
|
||||
assertTrue( "The Exception Message does not contain the DDL command causing the failure", ddlCommandFound );
|
||||
|
||||
assertTrue( commandAcceptanceException.getCause() instanceof IOException );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user