Search in sources :

Example 1 with DefaultConversionService

use of org.springframework.core.convert.support.DefaultConversionService in project spring-boot by spring-projects.

the class RelaxedDataBinderTests method testBindNestedListCommaDelimitedOnly.

@Test
public void testBindNestedListCommaDelimitedOnly() throws Exception {
    TargetWithNestedList target = new TargetWithNestedList();
    this.conversionService = new DefaultConversionService();
    bind(target, "nested: bar,foo");
    assertThat(target.getNested().toString()).isEqualTo("[bar, foo]");
}
Also used : DefaultConversionService(org.springframework.core.convert.support.DefaultConversionService) Test(org.junit.Test)

Example 2 with DefaultConversionService

use of org.springframework.core.convert.support.DefaultConversionService in project spring-boot by spring-projects.

the class RelaxedDataBinderTests method testBindNestedReadOnlyListIndexed.

@Test
public void testBindNestedReadOnlyListIndexed() throws Exception {
    TargetWithReadOnlyNestedList target = new TargetWithReadOnlyNestedList();
    this.conversionService = new DefaultConversionService();
    bind(target, "nested[0]: bar\nnested[1]:foo");
    assertThat(target.getNested().toString()).isEqualTo("[bar, foo]");
}
Also used : DefaultConversionService(org.springframework.core.convert.support.DefaultConversionService) Test(org.junit.Test)

Example 3 with DefaultConversionService

use of org.springframework.core.convert.support.DefaultConversionService in project spring-boot by spring-projects.

the class RelaxedDataBinderTests method testBindDoubleNestedReadOnlyListIndexed.

@Test
public void testBindDoubleNestedReadOnlyListIndexed() throws Exception {
    TargetWithReadOnlyDoubleNestedList target = new TargetWithReadOnlyDoubleNestedList();
    this.conversionService = new DefaultConversionService();
    bind(target, "bean.nested[0]:bar\nbean.nested[1]:foo");
    assertThat(target.getBean().getNested().toString()).isEqualTo("[bar, foo]");
}
Also used : DefaultConversionService(org.springframework.core.convert.support.DefaultConversionService) Test(org.junit.Test)

Example 4 with DefaultConversionService

use of org.springframework.core.convert.support.DefaultConversionService in project spring-boot by spring-projects.

the class RelaxedDataBinderTests method testBindCaseInsensitiveEnumsWithConverter.

@Test
public void testBindCaseInsensitiveEnumsWithConverter() throws Exception {
    VanillaTarget target = new VanillaTarget();
    this.conversionService = new DefaultConversionService();
    doTestBindCaseInsensitiveEnums(target);
}
Also used : DefaultConversionService(org.springframework.core.convert.support.DefaultConversionService) Test(org.junit.Test)

Example 5 with DefaultConversionService

use of org.springframework.core.convert.support.DefaultConversionService in project spring-boot by spring-projects.

the class RelaxedDataBinderTests method testBindNestedReadOnlyListCommaSeparated.

@Test(expected = NotWritablePropertyException.class)
public void testBindNestedReadOnlyListCommaSeparated() throws Exception {
    TargetWithReadOnlyNestedList target = new TargetWithReadOnlyNestedList();
    this.conversionService = new DefaultConversionService();
    bind(target, "nested: bar,foo");
    assertThat(target.getNested().toString()).isEqualTo("[bar, foo]");
}
Also used : DefaultConversionService(org.springframework.core.convert.support.DefaultConversionService) Test(org.junit.Test)

Aggregations

DefaultConversionService (org.springframework.core.convert.support.DefaultConversionService)84 Test (org.junit.jupiter.api.Test)37 Test (org.junit.Test)29 ConversionService (org.springframework.core.convert.ConversionService)13 MethodParameter (org.springframework.core.MethodParameter)12 GenericConversionService (org.springframework.core.convert.support.GenericConversionService)12 ConfigurableWebBindingInitializer (org.springframework.web.bind.support.ConfigurableWebBindingInitializer)12 WebDataBinderFactory (org.springframework.web.bind.support.WebDataBinderFactory)12 DefaultDataBinderFactory (org.springframework.web.bind.support.DefaultDataBinderFactory)11 DefaultListableBeanFactory (org.springframework.beans.factory.support.DefaultListableBeanFactory)9 RequestParam (org.springframework.web.bind.annotation.RequestParam)9 Optional (java.util.Optional)8 BeforeEach (org.junit.jupiter.api.BeforeEach)6 GenericApplicationContext (org.springframework.context.support.GenericApplicationContext)6 HashMap (java.util.HashMap)5 DefaultDatatypeChannelMessageConverter (org.springframework.integration.support.converter.DefaultDatatypeChannelMessageConverter)5 GenericMessage (org.springframework.messaging.support.GenericMessage)5 Before (org.junit.Before)4 ContentConverter (com.synopsys.integration.alert.common.ContentConverter)3 ConfigurationModelConfigurationAccessor (com.synopsys.integration.alert.common.persistence.accessor.ConfigurationModelConfigurationAccessor)3