Skip to content

Commit b1d5b5e

Browse files
committed
HHH-18198 - Remove @target
1 parent 366b86e commit b1d5b5e

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/TargetEmbeddableOnEmbeddedTest.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
import org.hibernate.testing.orm.junit.DomainModel;
1414
import org.hibernate.testing.orm.junit.SessionFactory;
1515
import org.hibernate.testing.orm.junit.SessionFactoryScope;
16-
import org.junit.Test;
16+
import org.junit.jupiter.api.Test;
1717

18-
import static org.junit.Assert.assertEquals;
18+
import static org.assertj.core.api.Assertions.assertThat;
19+
import static org.assertj.core.api.Assertions.offset;
1920

2021
/**
2122
* @author Jan Schatteman
@@ -39,8 +40,8 @@ public void testLifecycle(SessionFactoryScope factoryScope) {
3940
City city = session.find(City.class, 1L);
4041
assert city.getCoordinates() instanceof GPS;
4142
//end::embeddable-Target-fetching-example[]
42-
assertEquals(46.77120, city.getCoordinates().x(), 0.00001);
43-
assertEquals(23.62360, city.getCoordinates().y(), 0.00001);
43+
assertThat( city.getCoordinates().x() ).isCloseTo( 46.77120, offset( 0.00001 ) );
44+
assertThat( city.getCoordinates().y() ).isCloseTo( 23.62360, offset( 0.00001 ) );
4445
} );
4546
}
4647

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/TargetEmbeddableOnInterfaceTest.java

+12-11
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313
import org.hibernate.testing.orm.junit.DomainModel;
1414
import org.hibernate.testing.orm.junit.SessionFactory;
1515
import org.hibernate.testing.orm.junit.SessionFactoryScope;
16-
import org.junit.Test;
16+
import org.junit.jupiter.api.Test;
17+
18+
import static org.assertj.core.api.Assertions.assertThat;
19+
import static org.assertj.core.api.Assertions.offset;
1720

18-
import static org.junit.Assert.assertEquals;
1921

2022
/**
2123
* @author Jan Schatteman
@@ -27,19 +29,18 @@ public class TargetEmbeddableOnInterfaceTest {
2729
@Test
2830
public void testLifecycle(SessionFactoryScope factoryScope) {
2931
factoryScope.inTransaction( (session) -> {
30-
City cluj = new City();
31-
cluj.setName("Cluj");
32-
cluj.setCoordinates(new GPS(46.77120, 23.62360));
32+
City city = new City();
33+
city.setName("Cluj");
34+
city.setCoordinates( new GPS(46.77120, 23.62360 ) );
3335

34-
session.persist(cluj);
36+
session.persist( city );
3537
} );
3638

3739
factoryScope.inTransaction( (session) -> {
38-
City cluj = session.find(City.class, 1L);
39-
assert cluj.getCoordinates() instanceof GPS;
40-
41-
assertEquals(46.77120, cluj.getCoordinates().x(), 0.00001);
42-
assertEquals(23.62360, cluj.getCoordinates().y(), 0.00001);
40+
City city = session.find(City.class, 1L);
41+
assert city.getCoordinates() instanceof GPS;
42+
assertThat( city.getCoordinates().x() ).isCloseTo( 46.77120, offset( 0.00001 ) );
43+
assertThat( city.getCoordinates().y() ).isCloseTo( 23.62360, offset( 0.00001 ) );
4344
} );
4445
}
4546

0 commit comments

Comments
 (0)