use of io.crnk.core.engine.information.bean.BeanAttributeInformation in project crnk-framework by crnk-project.
the class JacksonResourceFieldInformationProviderNamingTest method onFieldWithoutJsonPropertyShouldReturnBaseName.
@Test
public void onFieldWithoutJsonPropertyShouldReturnBaseName() throws Exception {
BeanAttributeInformation field = beanDesc.getAttribute("field");
assertThat(sut.getJsonName(field).isPresent()).isFalse();
}
use of io.crnk.core.engine.information.bean.BeanAttributeInformation in project crnk-framework by crnk-project.
the class JacksonResourceFieldInformationProviderNamingTest method onFieldNameWithNamingStrategyShouldReturnModifiedName.
@Test
public void onFieldNameWithNamingStrategyShouldReturnModifiedName() throws Exception {
objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES);
sut = new JacksonResourceFieldInformationProvider();
sut.init(context);
Field field = TestClass.class.getDeclaredField("namingStrategyTest");
String name = sut.getName(field).get();
assertThat(name).isEqualTo("naming_strategy_test");
BeanAttributeInformation attr = beanDesc.getAttribute("namingStrategyTest");
assertThat(sut.getJsonName(attr).get()).isEqualTo("naming_strategy_test");
}
use of io.crnk.core.engine.information.bean.BeanAttributeInformation in project crnk-framework by crnk-project.
the class JacksonResourceFieldInformationProviderNamingTest method onWrappedFieldShouldReturnFieldNameBasedOnGetter.
@Test
public void onWrappedFieldShouldReturnFieldNameBasedOnGetter() throws Exception {
BeanAttributeInformation attr = beanDesc.getAttribute("booleanProperty");
assertThat(sut.getJsonName(attr).isPresent()).isFalse();
}
Aggregations