Skip to content

Commit da0d06b

Browse files
committed
fix: add ignored attribute property descriptor tests
1 parent a74f925 commit da0d06b

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

graphql-jpa-query-schema/src/main/java/com/introproventures/graphql/jpa/query/schema/impl/IntrospectionUtils.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ public Collection<AttributePropertyDescriptor> getPersistentPropertyDescriptors(
144144
.collect(Collectors.toList());
145145
}
146146

147+
public Collection<AttributePropertyDescriptor> getIgnoredPropertyDescriptors() {
148+
return descriptors.values()
149+
.stream()
150+
.filter(AttributePropertyDescriptor::isIgnored)
151+
.collect(Collectors.toList());
152+
}
153+
147154
public Map<String, Attribute<?, ?>> getAttributes() {
148155
return attributes;
149156
}

graphql-jpa-query-schema/src/test/java/com/introproventures/graphql/jpa/query/schema/IntrospectionUtilsTest.java

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,28 @@ public void testGetPersistentPropertyDescriptors() {
336336
"UppercaseGetter",
337337
"propertyDuplicatedInChild",
338338
"age");
339-
;
340339
}
341-
342-
340+
341+
@Test
342+
public void testGetIgnoredPropertyDescriptors() {
343+
// given
344+
ManagedType<?> managedType = entityManager.getMetamodel().entity(CalculatedEntity.class);
345+
346+
// when
347+
EntityIntrospectionResult result = IntrospectionUtils.introspect(managedType);
348+
349+
// then
350+
assertThat(result.getIgnoredPropertyDescriptors()).extracting(AttributePropertyDescriptor::getName)
351+
.containsOnly("uppercaseGetterIgnore",
352+
"hideFieldFunction",
353+
"parentGraphQLIgnore",
354+
"parentGraphQLIgnoreGetter",
355+
"transientModifierGraphQLIgnore",
356+
"propertyIgnoredOnGetter",
357+
"parentTransientModifierGraphQLIgnore",
358+
"ignoredTransientValue",
359+
"hideField",
360+
"parentTransientGraphQLIgnoreGetter",
361+
"parentTransientGraphQLIgnore");
362+
}
343363
}

0 commit comments

Comments
 (0)