Skip to content

Commit 0d8541a

Browse files
yrodierebeikov
authored andcommitted
HHH-16403 Upgrade to assertj 3.22.0
1 parent be9813a commit 0d8541a

File tree

4 files changed

+33
-28
lines changed

4 files changed

+33
-28
lines changed

hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhance/internal/bytebuddy/DirtyCheckingWithEmbeddableAndMappedSuperclassTest.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.junit.runner.RunWith;
2525

2626
import static org.assertj.core.api.Assertions.assertThat;
27+
import static org.assertj.core.extractor.Extractors.resultOf;
2728
import static org.hibernate.bytecode.enhance.spi.EnhancerConstants.ENTITY_ENTRY_FIELD_NAME;
2829
import static org.hibernate.bytecode.enhance.spi.EnhancerConstants.ENTITY_ENTRY_GETTER_NAME;
2930
import static org.hibernate.bytecode.enhance.spi.EnhancerConstants.ENTITY_INSTANCE_GETTER_NAME;
@@ -92,8 +93,8 @@ public void shouldCreateTheTracker() throws Exception {
9293
assertThat( entity.getFirstPlayerToken() )
9394
.extracting( TRACKER_COMPOSITE_FIELD_NAME ).isInstanceOf( CompositeOwnerTracker.class);
9495

95-
assertThat( entity ).extracting( TRACKER_HAS_CHANGED_NAME ).isEqualTo( true );
96-
assertThat( entity ).extracting( TRACKER_GET_NAME )
96+
assertThat( entity ).extracting( resultOf( TRACKER_HAS_CHANGED_NAME ) ).isEqualTo( true );
97+
assertThat( entity ).extracting( resultOf( TRACKER_GET_NAME ) )
9798
.isEqualTo( new String[] { "name", "firstPlayerToken" } );
9899
assertThat( entity.getFirstPlayerToken() )
99100
.extracting( TRACKER_COMPOSITE_FIELD_NAME + ".names" ).isEqualTo( new String[] { "firstPlayerToken" } );
@@ -106,8 +107,8 @@ public void shouldResetTheTracker() throws Exception {
106107
Method trackerClearMethod = CardGame.class.getMethod( TRACKER_CLEAR_NAME );
107108
trackerClearMethod.invoke( entity );
108109

109-
assertThat( entity ).extracting( TRACKER_HAS_CHANGED_NAME ).isEqualTo( false );
110-
assertThat( entity ).extracting( TRACKER_GET_NAME ).isEqualTo( new String[0] );
110+
assertThat( entity ).extracting( resultOf( TRACKER_HAS_CHANGED_NAME ) ).isEqualTo( false );
111+
assertThat( entity ).extracting( resultOf( TRACKER_GET_NAME ) ).isEqualTo( new String[0] );
111112
}
112113

113114
@Test
@@ -119,14 +120,14 @@ public void shouldUpdateTheTracker() throws Exception {
119120

120121
entity.setName( "Splendor: Cities of Splendor" );
121122

122-
assertThat( entity ).extracting( TRACKER_HAS_CHANGED_NAME ).isEqualTo( true );
123-
assertThat( entity ).extracting( TRACKER_GET_NAME )
123+
assertThat( entity ).extracting( resultOf( TRACKER_HAS_CHANGED_NAME ) ).isEqualTo( true );
124+
assertThat( entity ).extracting( resultOf( TRACKER_GET_NAME ) )
124125
.isEqualTo( new String[] { "name", "firstPlayerToken" } );
125126

126127
trackerClearMethod.invoke( entity );
127128

128129
entity.setFirstPlayerToken( new Component( "FIRST PLAYER!!!!!!!!" ) );
129-
assertThat( entity ).extracting( TRACKER_GET_NAME )
130+
assertThat( entity ).extracting( resultOf( TRACKER_GET_NAME ) )
130131
.isEqualTo( new String[] { "firstPlayerToken" } );
131132
assertThat( entity.getFirstPlayerToken() )
132133
.extracting( TRACKER_COMPOSITE_FIELD_NAME + ".names" ).isEqualTo( new String[] { "firstPlayerToken" } );

hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhance/internal/bytebuddy/DirtyCheckingWithEmbeddedOnGetterTest.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.assertj.core.api.Assertions;
2626

2727
import static org.assertj.core.api.Assertions.assertThat;
28+
import static org.assertj.core.extractor.Extractors.resultOf;
2829
import static org.hibernate.bytecode.enhance.spi.EnhancerConstants.ENTITY_ENTRY_FIELD_NAME;
2930
import static org.hibernate.bytecode.enhance.spi.EnhancerConstants.ENTITY_ENTRY_GETTER_NAME;
3031
import static org.hibernate.bytecode.enhance.spi.EnhancerConstants.ENTITY_INSTANCE_GETTER_NAME;
@@ -93,8 +94,8 @@ public void shouldCreateTheTracker() throws Exception {
9394
assertThat( entity.getFirstPlayerToken() )
9495
.extracting( TRACKER_COMPOSITE_FIELD_NAME ).isInstanceOf( CompositeOwnerTracker.class );
9596

96-
assertThat( entity ).extracting( TRACKER_HAS_CHANGED_NAME ).isEqualTo( true );
97-
assertThat( entity ).extracting( TRACKER_GET_NAME )
97+
assertThat( entity ).extracting( resultOf( TRACKER_HAS_CHANGED_NAME ) ).isEqualTo( true );
98+
assertThat( entity ).extracting( resultOf( TRACKER_GET_NAME ) )
9899
.isEqualTo( new String[] { "name", "firstPlayerToken" } );
99100
assertThat( entity.getFirstPlayerToken() ).extracting( TRACKER_COMPOSITE_FIELD_NAME + ".names" )
100101
.isEqualTo( new String[] { "firstPlayerToken" } );
@@ -107,8 +108,8 @@ public void shouldResetTheTracker() throws Exception {
107108
Method trackerClearMethod = CardGame.class.getMethod( TRACKER_CLEAR_NAME );
108109
trackerClearMethod.invoke( entity );
109110

110-
assertThat( entity ).extracting( TRACKER_HAS_CHANGED_NAME ).isEqualTo( false );
111-
assertThat( entity ).extracting( TRACKER_GET_NAME ).isEqualTo( new String[0] );
111+
assertThat( entity ).extracting( resultOf( TRACKER_HAS_CHANGED_NAME ) ).isEqualTo( false );
112+
assertThat( entity ).extracting( resultOf( TRACKER_GET_NAME ) ).isEqualTo( new String[0] );
112113
}
113114

114115
@Test
@@ -121,14 +122,14 @@ public void shouldUpdateTheTracker() throws Exception {
121122

122123
entity.setName( "Splendor: Cities of Splendor" );
123124

124-
assertThat( entity ).extracting( TRACKER_HAS_CHANGED_NAME ).isEqualTo( true );
125-
assertThat( entity ).extracting( TRACKER_GET_NAME )
125+
assertThat( entity ).extracting( resultOf( TRACKER_HAS_CHANGED_NAME ) ).isEqualTo( true );
126+
assertThat( entity ).extracting( resultOf( TRACKER_GET_NAME ) )
126127
.isEqualTo( new String[] { "name", "firstPlayerToken" } );
127128

128129
trackerClearMethod.invoke( entity );
129130

130131
entity.setFirstPlayerToken( new Component( "FIRST PLAYER!!!!!!!!" ) );
131-
assertThat( entity ).extracting( TRACKER_GET_NAME )
132+
assertThat( entity ).extracting( resultOf( TRACKER_GET_NAME ) )
132133
.isEqualTo( new String[] { "firstPlayerToken" } );
133134

134135
assertThat( entity.getFirstPlayerToken() ).extracting( TRACKER_COMPOSITE_FIELD_NAME + ".names" )

hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhance/internal/bytebuddy/DirtyCheckingWithEmbeddedTest.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.assertj.core.api.Assertions;
2626

2727
import static org.assertj.core.api.Assertions.assertThat;
28+
import static org.assertj.core.extractor.Extractors.resultOf;
2829
import static org.hibernate.bytecode.enhance.spi.EnhancerConstants.ENTITY_ENTRY_FIELD_NAME;
2930
import static org.hibernate.bytecode.enhance.spi.EnhancerConstants.ENTITY_ENTRY_GETTER_NAME;
3031
import static org.hibernate.bytecode.enhance.spi.EnhancerConstants.ENTITY_INSTANCE_GETTER_NAME;
@@ -93,8 +94,8 @@ public void shouldCreateTheTracker() throws Exception {
9394
assertThat( entity.getFirstPlayerToken() )
9495
.extracting( TRACKER_COMPOSITE_FIELD_NAME ).isInstanceOf( CompositeOwnerTracker.class );
9596

96-
assertThat( entity ).extracting( TRACKER_HAS_CHANGED_NAME ).isEqualTo( true );
97-
assertThat( entity ).extracting( TRACKER_GET_NAME )
97+
assertThat( entity ).extracting( resultOf( TRACKER_HAS_CHANGED_NAME ) ).isEqualTo( true );
98+
assertThat( entity ).extracting( resultOf( TRACKER_GET_NAME ) )
9899
.isEqualTo( new String[] { "name", "firstPlayerToken" } );
99100
assertThat( entity.getFirstPlayerToken() ).extracting( TRACKER_COMPOSITE_FIELD_NAME + ".names" )
100101
.isEqualTo( new String[] { "firstPlayerToken" } );
@@ -107,8 +108,8 @@ public void shouldResetTheTracker() throws Exception {
107108
Method trackerClearMethod = CardGame.class.getMethod( TRACKER_CLEAR_NAME );
108109
trackerClearMethod.invoke( entity );
109110

110-
assertThat( entity ).extracting( TRACKER_HAS_CHANGED_NAME ).isEqualTo( false );
111-
assertThat( entity ).extracting( TRACKER_GET_NAME ).isEqualTo( new String[0] );
111+
assertThat( entity ).extracting( resultOf( TRACKER_HAS_CHANGED_NAME ) ).isEqualTo( false );
112+
assertThat( entity ).extracting( resultOf( TRACKER_GET_NAME ) ).isEqualTo( new String[0] );
112113
}
113114

114115
@Test
@@ -121,14 +122,14 @@ public void shouldUpdateTheTracker() throws Exception {
121122

122123
entity.setName( "Splendor: Cities of Splendor" );
123124

124-
assertThat( entity ).extracting( TRACKER_HAS_CHANGED_NAME ).isEqualTo( true );
125-
assertThat( entity ).extracting( TRACKER_GET_NAME )
125+
assertThat( entity ).extracting( resultOf( TRACKER_HAS_CHANGED_NAME ) ).isEqualTo( true );
126+
assertThat( entity ).extracting( resultOf( TRACKER_GET_NAME ) )
126127
.isEqualTo( new String[] { "name", "firstPlayerToken" } );
127128

128129
trackerClearMethod.invoke( entity );
129130

130131
entity.setFirstPlayerToken( new Component( "FIRST PLAYER!!!!!!!!" ) );
131-
assertThat( entity ).extracting( TRACKER_GET_NAME )
132+
assertThat( entity ).extracting( resultOf( TRACKER_GET_NAME ) )
132133
.isEqualTo( new String[] { "firstPlayerToken" } );
133134

134135
assertThat( entity.getFirstPlayerToken() ).extracting( TRACKER_COMPOSITE_FIELD_NAME + ".names" )

hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhance/internal/bytebuddy/DirtyCheckingWithMappedsuperclassTest.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import jakarta.persistence.Entity;
1111
import jakarta.persistence.Id;
1212
import jakarta.persistence.MappedSuperclass;
13+
import org.assertj.core.extractor.Extractors;
1314

1415
import org.hibernate.bytecode.enhance.internal.tracker.SimpleFieldTracker;
1516

@@ -20,6 +21,7 @@
2021
import org.junit.runner.RunWith;
2122

2223
import static org.assertj.core.api.Assertions.assertThat;
24+
import static org.assertj.core.extractor.Extractors.resultOf;
2325
import static org.hibernate.bytecode.enhance.spi.EnhancerConstants.ENTITY_ENTRY_FIELD_NAME;
2426
import static org.hibernate.bytecode.enhance.spi.EnhancerConstants.ENTITY_ENTRY_GETTER_NAME;
2527
import static org.hibernate.bytecode.enhance.spi.EnhancerConstants.ENTITY_INSTANCE_GETTER_NAME;
@@ -71,8 +73,8 @@ public void shouldCreateTheTracker() throws Exception {
7173
assertThat( entity )
7274
.extracting( TRACKER_FIELD_NAME ).isInstanceOf( SimpleFieldTracker.class );
7375

74-
assertThat( entity ).extracting( TRACKER_HAS_CHANGED_NAME ).isEqualTo( true );
75-
assertThat( entity ).extracting( TRACKER_GET_NAME ).isEqualTo( new String[] { "name", "code" } );
76+
assertThat( entity ).extracting( resultOf( TRACKER_HAS_CHANGED_NAME ) ).isEqualTo( true );
77+
assertThat( entity ).extracting( resultOf( TRACKER_GET_NAME ) ).isEqualTo( new String[] { "name", "code" } );
7678
}
7779

7880
@Test
@@ -82,8 +84,8 @@ public void shouldResetTheTracker() throws Exception {
8284
Method trackerClearMethod = CardGame.class.getMethod( TRACKER_CLEAR_NAME );
8385
trackerClearMethod.invoke( entity );
8486

85-
assertThat( entity ).extracting( TRACKER_HAS_CHANGED_NAME ).isEqualTo( false );
86-
assertThat( entity ).extracting( TRACKER_GET_NAME ).isEqualTo( new String[0] );
87+
assertThat( entity ).extracting( resultOf( TRACKER_HAS_CHANGED_NAME ) ).isEqualTo( false );
88+
assertThat( entity ).extracting( resultOf( TRACKER_GET_NAME ) ).isEqualTo( new String[0] );
8789
}
8890

8991
@Test
@@ -98,12 +100,12 @@ public void shouldUpdateTheTracker() throws Exception {
98100

99101
assertThat( entity.getCode() )
100102
.as( "Field 'code' should have not change" ).isEqualTo( "XsplX" );
101-
assertThat( entity ).extracting( TRACKER_HAS_CHANGED_NAME ).isEqualTo( true );
102-
assertThat( entity ).extracting( TRACKER_GET_NAME ).isEqualTo( new String[] { "name" } );
103+
assertThat( entity ).extracting( resultOf( TRACKER_HAS_CHANGED_NAME ) ).isEqualTo( true );
104+
assertThat( entity ).extracting( resultOf( TRACKER_GET_NAME ) ).isEqualTo( new String[] { "name" } );
103105

104106
entity.setName( "Cities of Splendor" );
105107

106-
assertThat( entity ).extracting( TRACKER_GET_NAME ).isEqualTo( new String[] { "name", "code" } );
108+
assertThat( entity ).extracting( resultOf( TRACKER_GET_NAME ) ).isEqualTo( new String[] { "name", "code" } );
107109
}
108110

109111
@MappedSuperclass

0 commit comments

Comments
 (0)