|
27 | 27 | import java.util.List; |
28 | 28 | import java.util.UUID; |
29 | 29 |
|
| 30 | +import org.assertj.core.api.SoftAssertions; |
30 | 31 | import org.junit.jupiter.api.Test; |
31 | 32 | import org.springframework.data.annotation.Id; |
32 | 33 | import org.springframework.data.mapping.PersistentPropertyPath; |
@@ -98,10 +99,33 @@ public void detectsKeyColumnOverrideNameFromMappedCollectionAnnotation() { |
98 | 99 | @Test // #938 |
99 | 100 | void considersAggregateReferenceAnAssociation() { |
100 | 101 |
|
101 | | - RelationalPersistentEntity<?> entity = context.getRequiredPersistentEntity(WithAssociations.class); |
102 | | - RelationalPersistentProperty property = entity.getRequiredPersistentProperty("association"); |
103 | | - |
104 | | - assertThat(property.isAssociation()).isTrue(); |
| 102 | + RelationalPersistentEntity<?> entity = context.getRequiredPersistentEntity(DummyEntity.class); |
| 103 | + |
| 104 | + SoftAssertions.assertSoftly(softly -> { |
| 105 | + |
| 106 | + softly.assertThat(entity.getRequiredPersistentProperty("reference").isAssociation()) // |
| 107 | + .as("reference") // |
| 108 | + .isTrue(); |
| 109 | + |
| 110 | + softly.assertThat(entity.getRequiredPersistentProperty("id").isAssociation()) // |
| 111 | + .as("id") // |
| 112 | + .isFalse(); |
| 113 | + softly.assertThat(entity.getRequiredPersistentProperty("someEnum").isAssociation()) // |
| 114 | + .as("someEnum") // |
| 115 | + .isFalse(); |
| 116 | + softly.assertThat(entity.getRequiredPersistentProperty("localDateTime").isAssociation()) // |
| 117 | + .as("localDateTime") // |
| 118 | + .isFalse(); |
| 119 | + softly.assertThat(entity.getRequiredPersistentProperty("zonedDateTime").isAssociation()) // |
| 120 | + .as("zonedDateTime") // |
| 121 | + .isFalse(); |
| 122 | + softly.assertThat(entity.getRequiredPersistentProperty("listField").isAssociation()) // |
| 123 | + .as("listField") // |
| 124 | + .isFalse(); |
| 125 | + softly.assertThat(entity.getRequiredPersistentProperty("uuid").isAssociation()) // |
| 126 | + .as("uuid") // |
| 127 | + .isFalse(); |
| 128 | + }); |
105 | 129 | } |
106 | 130 |
|
107 | 131 | private PersistentPropertyPathExtension getPersistentPropertyPath(Class<?> type, String propertyName) { |
@@ -158,8 +182,4 @@ private static class WithCollections { |
158 | 182 | @MappedCollection(idColumn = "override_id", keyColumn = "override_key") // |
159 | 183 | List<Integer> overrideList; |
160 | 184 | } |
161 | | - |
162 | | - static class WithAssociations { |
163 | | - AggregateReference<Object, Long> association; |
164 | | - } |
165 | 185 | } |
0 commit comments