Search in sources :

Example 1 with CoerceBean

use of example.CoerceBean in project elide by yahoo.

the class EntityDictionaryTest method testCoerce.

@Test
public void testCoerce() throws Exception {
    bindEntity(CoerceBean.class);
    CoerceBean bean = new CoerceBean();
    setValue(bean, "string", 1L);
    setValue(bean, "list", ImmutableSet.of(true, false));
    setValue(bean, "map", ImmutableMap.of("one", "1", "two", "2"));
    setValue(bean, "set", ImmutableList.of(3L, 4L));
    assertEquals("1", bean.string);
    assertEquals(Arrays.asList(true, false), bean.list);
    assertEquals(ImmutableMap.of("one", 1L, "two", 2L), bean.map);
    assertEquals(ImmutableSet.of(3.0, 4.0), bean.set);
}
Also used : CoerceBean(example.CoerceBean) Test(org.junit.jupiter.api.Test)

Aggregations

CoerceBean (example.CoerceBean)1 Test (org.junit.jupiter.api.Test)1