fix some warnings in a couple of tests

This commit is contained in:
Gavin King 2022-01-29 15:21:15 +01:00
parent 56232a0159
commit 135216b0a9
2 changed files with 24 additions and 24 deletions

View File

@ -38,7 +38,7 @@ import static org.junit.Assert.fail;
public class JoinTest extends BaseNonConfigCoreFunctionalTestCase {
@Test
public void testDefaultValue() {
Join join = (Join) metadata().getEntityBinding( Life.class.getName() ).getJoinClosureIterator().next();
Join join = metadata().getEntityBinding( Life.class.getName() ).getJoinClosureIterator().next();
assertEquals( "ExtendedLife", join.getTable().getName() );
org.hibernate.mapping.Column owner = new org.hibernate.mapping.Column();
owner.setName( "LIFE_ID" );
@ -62,8 +62,8 @@ public class JoinTest extends BaseNonConfigCoreFunctionalTestCase {
}
@Test
public void testCompositePK() throws Exception {
Join join = (Join) metadata().getEntityBinding( Dog.class.getName() ).getJoinClosureIterator().next();
public void testCompositePK() {
Join join = metadata().getEntityBinding( Dog.class.getName() ).getJoinClosureIterator().next();
assertEquals( "DogThoroughbred", join.getTable().getName() );
org.hibernate.mapping.Column owner = new org.hibernate.mapping.Column();
owner.setName( "OWNER_NAME" );
@ -91,7 +91,7 @@ public class JoinTest extends BaseNonConfigCoreFunctionalTestCase {
}
@Test
public void testExplicitValue() throws Exception {
public void testExplicitValue() {
Session s = openSession();
Transaction tx = s.beginTransaction();
Death death = new Death();
@ -152,7 +152,7 @@ public class JoinTest extends BaseNonConfigCoreFunctionalTestCase {
s.beginTransaction();
SysGroupsOrm g=new SysGroupsOrm();
SysUserOrm u=new SysUserOrm();
u.setGroups( new ArrayList<SysGroupsOrm>() );
u.setGroups( new ArrayList<>() );
u.getGroups().add( g );
s.save( g );
s.save( u );
@ -161,7 +161,7 @@ public class JoinTest extends BaseNonConfigCoreFunctionalTestCase {
}
@Test
public void testUniqueConstaintOnSecondaryTable() throws Exception {
public void testUniqueConstaintOnSecondaryTable() {
Cat cat = new Cat();
cat.setStoryPart2( "My long story" );
Cat cat2 = new Cat();
@ -189,7 +189,7 @@ public class JoinTest extends BaseNonConfigCoreFunctionalTestCase {
}
@Test
public void testFetchModeOnSecondaryTable() throws Exception {
public void testFetchModeOnSecondaryTable() {
Cat cat = new Cat();
cat.setStoryPart2( "My long story" );
Session s = openSession();
@ -207,7 +207,7 @@ public class JoinTest extends BaseNonConfigCoreFunctionalTestCase {
}
@Test
public void testCustomSQL() throws Exception {
public void testCustomSQL() {
Cat cat = new Cat();
String storyPart2 = "My long story";
cat.setStoryPart2( storyPart2 );
@ -218,7 +218,7 @@ public class JoinTest extends BaseNonConfigCoreFunctionalTestCase {
s.flush();
s.clear();
Cat c = (Cat) s.get( Cat.class, cat.getId() );
Cat c = s.get( Cat.class, cat.getId() );
assertEquals( storyPart2.toUpperCase(Locale.ROOT), c.getStoryPart2() );
tx.rollback();
@ -226,7 +226,7 @@ public class JoinTest extends BaseNonConfigCoreFunctionalTestCase {
}
@Test
public void testMappedSuperclassAndSecondaryTable() throws Exception {
public void testMappedSuperclassAndSecondaryTable() {
Session s = openSession( );
s.getTransaction().begin();
C c = new C();
@ -236,7 +236,7 @@ public class JoinTest extends BaseNonConfigCoreFunctionalTestCase {
s.persist( c );
s.flush();
s.clear();
c= (C) s.get( C.class, c.getId() );
c= s.get( C.class, c.getId() );
assertNotNull( c.getCreateDate() );
assertNotNull( c.getName() );
s.getTransaction().rollback();

View File

@ -41,7 +41,7 @@ import static org.junit.Assert.assertTrue;
*/
public class OneToOneTest extends BaseNonConfigCoreFunctionalTestCase {
@Test
public void testEagerFetching() throws Exception {
public void testEagerFetching() {
final String clientName = "Emmanuel";
TransactionUtil.doInHibernate( this::sessionFactory, session -> {
Client c = new Client();
@ -67,7 +67,7 @@ public class OneToOneTest extends BaseNonConfigCoreFunctionalTestCase {
}
@Test
public void testDefaultOneToOne() throws Exception {
public void testDefaultOneToOne() {
//test a default one to one and a mappedBy in the other side
Long customerId = TransactionUtil.doInHibernate( this::sessionFactory, session -> {
Customer c = new Customer();
@ -94,7 +94,7 @@ public class OneToOneTest extends BaseNonConfigCoreFunctionalTestCase {
}
@Test
public void testOneToOneWithExplicitFk() throws Exception {
public void testOneToOneWithExplicitFk() {
final Client c = new Client();
Address a = new Address();
a.setCity( "Paris" );
@ -115,7 +115,7 @@ public class OneToOneTest extends BaseNonConfigCoreFunctionalTestCase {
}
@Test
public void testOneToOneWithExplicitSecondaryTableFk() throws Exception {
public void testOneToOneWithExplicitSecondaryTableFk() {
final Client c = new Client();
Address a = new Address();
a.setCity( "Paris" );
@ -136,7 +136,7 @@ public class OneToOneTest extends BaseNonConfigCoreFunctionalTestCase {
}
@Test
public void testUnidirectionalTrueOneToOne() throws Exception {
public void testUnidirectionalTrueOneToOne() {
final Body b = new Body();
final Heart h = new Heart();
b.setHeart( h );
@ -157,7 +157,7 @@ public class OneToOneTest extends BaseNonConfigCoreFunctionalTestCase {
}
@Test
public void testCompositePk() throws Exception {
public void testCompositePk() {
final ComputerPk cid = new ComputerPk();
final SerialNumber sn = new SerialNumber();
TransactionUtil.doInHibernate( this::sessionFactory, session -> {
@ -184,7 +184,7 @@ public class OneToOneTest extends BaseNonConfigCoreFunctionalTestCase {
}
@Test
public void testBidirectionalTrueOneToOne() throws Exception {
public void testBidirectionalTrueOneToOne() {
try (Session s = openSession()) {
Party party = new Party();
PartyAffiliate affiliate = new PartyAffiliate();
@ -234,7 +234,7 @@ public class OneToOneTest extends BaseNonConfigCoreFunctionalTestCase {
}
@Test
public void testBidirectionalFkOneToOne() throws Exception {
public void testBidirectionalFkOneToOne() {
try (Session s = openSession()) {
s.getTransaction().begin();
Trousers trousers = new Trousers();
@ -303,13 +303,13 @@ public class OneToOneTest extends BaseNonConfigCoreFunctionalTestCase {
@TestForIssue( jiraKey = "HHH-4606" )
public void testJoinColumnConfiguredInXml() {
PersistentClass pc = metadata().getEntityBinding( Son.class.getName() );
Iterator iter = pc.getJoinIterator();
Table table = ( ( Join ) iter.next() ).getTable();
Iterator columnIter = table.getColumnIterator();
Iterator<Join> iter = pc.getJoinIterator();
Table table = iter.next().getTable();
Iterator<Column> columnIter = table.getColumnIterator();
boolean fooFound = false;
boolean barFound = false;
while ( columnIter.hasNext() ) {
Column column = ( Column ) columnIter.next();
Column column = columnIter.next();
if ( column.getName().equals( "foo" ) ) {
fooFound = true;
}
@ -387,7 +387,7 @@ public class OneToOneTest extends BaseNonConfigCoreFunctionalTestCase {
@Test
@TestForIssue(jiraKey = "HHH-5757")
public void testHqlQuery() throws Exception {
public void testHqlQuery() {
//test a default one to one and a mappedBy in the other side
final Passport passport = TransactionUtil.doInHibernate( this::sessionFactory, session -> {
Customer c = new Customer();