use of io.crnk.core.engine.information.resource.ResourceInformation in project crnk-framework by crnk-project.
the class DefaultResourceInformationProviderTest method shouldInheritGlobalForDefaultLookupBehaviorWhenDefault.
@Test
public void shouldInheritGlobalForDefaultLookupBehaviorWhenDefault() throws Exception {
ResourceInformationProvider resourceInformationProviderWithProperty = getResourceInformationProviderWithProperty(CrnkProperties.INCLUDE_AUTOMATICALLY_OVERWRITE, "true");
ResourceInformation resourceInformation = resourceInformationProviderWithProperty.build(JsonResourceWithDefaultLookupBehaviorRelationship.class);
assertThat(resourceInformation.getRelationshipFields()).extracting("lookupIncludeBehavior").contains(LookupIncludeBehavior.AUTOMATICALLY_ALWAYS);
}
use of io.crnk.core.engine.information.resource.ResourceInformation in project crnk-framework by crnk-project.
the class DefaultResourceInformationProviderTest method shouldHaveGetterBooleanWithIsPrefix.
@Test
public void shouldHaveGetterBooleanWithIsPrefix() throws Exception {
ResourceInformation resourceInformation = resourceInformationProvider.build(Task.class);
assertThat(containsFieldWithName(resourceInformation, "completed")).isTrue();
}
use of io.crnk.core.engine.information.resource.ResourceInformation in project crnk-framework by crnk-project.
the class DefaultResourceInformationProviderTest method shouldReturnIdFieldBasedOnFieldGetter.
@Test
public void shouldReturnIdFieldBasedOnFieldGetter() throws Exception {
ResourceInformation resourceInformation = resourceInformationProvider.build(IdFieldWithAccessorGetterResource.class);
assertThat(resourceInformation.getIdField()).isNotNull();
}
use of io.crnk.core.engine.information.resource.ResourceInformation in project crnk-framework by crnk-project.
the class DefaultResourceInformationProviderTest method shouldHaveProperTypeWhenFieldAndGetterTypesDiffer.
@Test
public void shouldHaveProperTypeWhenFieldAndGetterTypesDiffer() throws Exception {
ResourceInformation resourceInformation = resourceInformationProvider.build(DifferentTypes.class);
assertThat(resourceInformation.getRelationshipFields()).isNotNull().hasSize(1).extracting("type").contains(String.class);
}
use of io.crnk.core.engine.information.resource.ResourceInformation in project crnk-framework by crnk-project.
the class DefaultResourceInformationProviderTest method shouldRecognizeJsonAPIRelationTypeWithNonDefaults.
@Test
public void shouldRecognizeJsonAPIRelationTypeWithNonDefaults() throws Exception {
ResourceInformation resourceInformation = resourceInformationProvider.build(JsonApiRelationTypeNonDefaults.class);
assertThat(resourceInformation.getRelationshipFields()).isNotEmpty().hasSize(2).extracting("type").contains(Future.class).contains(Collection.class);
assertThat(resourceInformation.getRelationshipFields()).extracting("serializeType").contains(SerializeType.ONLY_ID, SerializeType.EAGER);
assertThat(resourceInformation.getRelationshipFields()).extracting("lookupIncludeBehavior").contains(LookupIncludeBehavior.AUTOMATICALLY_ALWAYS, LookupIncludeBehavior.AUTOMATICALLY_WHEN_NULL);
assertThat(resourceInformation.getRelationshipFields()).extracting("resourceFieldType").contains(ResourceFieldType.RELATIONSHIP, ResourceFieldType.RELATIONSHIP);
}
Aggregations