Skip to content

Commit a08fe12

Browse files
committed
fix annoying assertions that test error message text
1 parent f45d153 commit a08fe12

File tree

3 files changed

+10
-17
lines changed

3 files changed

+10
-17
lines changed

hibernate-core/src/test/java/org/hibernate/orm/test/procedure/MySQLStoredProcedureTest.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -408,10 +408,7 @@ public void testStoredProcedureNullParameterHibernateWithoutSettingTheParameter(
408408
fail( "Should have thrown exception" );
409409
}
410410
catch (IllegalArgumentException e) {
411-
assertEquals(
412-
"The parameter at position [1] was not set! You need to call the setParameter method.",
413-
e.getMessage()
414-
);
411+
assertTrue( e.getMessage().contains( "parameter at position 1" ) );
415412
}
416413
} );
417414
}

hibernate-core/src/test/java/org/hibernate/orm/test/procedure/PostgreSQLFunctionProcedureTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,6 @@ public void testFunctionProcedureNullParameterHibernateWithoutSettingTheParamete
369369
procedureCall.execute();
370370
} ) );
371371

372-
assertThat( exception.getMessage() )
373-
.isEqualTo( "The parameter named [param] was not set! You need to call the setParameter method." );
372+
assertThat( exception.getMessage() ).contains( "parameter named 'param'" );
374373
}
375374
}

hibernate-core/src/test/java/org/hibernate/orm/test/procedure/PostgreSQLStoredProcedureTest.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@
3939

4040
import static org.hamcrest.MatcherAssert.assertThat;
4141
import static org.hamcrest.core.Is.is;
42-
import static org.junit.Assert.assertEquals;
43-
import static org.junit.Assert.assertFalse;
44-
import static org.junit.Assert.assertTrue;
45-
import static org.junit.Assert.fail;
42+
import static org.junit.jupiter.api.Assertions.assertEquals;
43+
import static org.junit.jupiter.api.Assertions.assertFalse;
44+
import static org.junit.jupiter.api.Assertions.assertTrue;
45+
import static org.junit.jupiter.api.Assertions.fail;
4646

4747
/**
4848
* @author Vlad Mihalcea
@@ -230,10 +230,7 @@ public void testStoredProcedureNullParameterHibernateWithoutSettingTheParameter(
230230
fail( "Should have thrown exception" );
231231
}
232232
catch (IllegalArgumentException e) {
233-
assertEquals(
234-
"The parameter named [param] was not set! You need to call the setParameter method.",
235-
e.getMessage()
236-
);
233+
assertTrue( e.getMessage().contains( "parameter named 'param'" ) );
237234
}
238235
} );
239236
}
@@ -253,7 +250,7 @@ public void testStoredProcedureInAndOutAndRefCursorParameters(EntityManagerFacto
253250
query.execute();
254251
ResultSet rs = (ResultSet) query.getOutputParameterValue( "rec_out" );
255252
try {
256-
Assertions.assertTrue( rs.next() );
253+
assertTrue( rs.next() );
257254
assertThat( rs.getString( "street" ), is( STREET ) );
258255
assertThat( rs.getString( "city" ), is( CITY ) );
259256
assertThat( rs.getString( "zip" ), is( ZIP ) );
@@ -280,7 +277,7 @@ public void testStoredProcedureInAndOutAndRefCursorParametersDifferentRegistrati
280277
query.execute();
281278
ResultSet rs = (ResultSet) query.getOutputParameterValue( "rec_out" );
282279
try {
283-
Assertions.assertTrue( rs.next() );
280+
assertTrue( rs.next() );
284281
assertThat( rs.getString( "street" ), is( STREET ) );
285282
assertThat( rs.getString( "city" ), is( CITY ) );
286283
assertThat( rs.getString( "zip" ), is( ZIP ) );
@@ -307,7 +304,7 @@ public void testStoredProcedureInAndOutAndRefCursorParametersDifferentRegistrati
307304
query.execute();
308305
ResultSet rs = (ResultSet) query.getOutputParameterValue( "rec_out" );
309306
try {
310-
Assertions.assertTrue( rs.next() );
307+
assertTrue( rs.next() );
311308
assertThat( rs.getString( "street" ), is( STREET ) );
312309
assertThat( rs.getString( "city" ), is( CITY ) );
313310
assertThat( rs.getString( "zip" ), is( ZIP ) );

0 commit comments

Comments
 (0)