use of org.hibernate.property.access.internal.PropertyAccessStrategyMapImpl in project hibernate-orm by hibernate.
the class PropertyAccessStrategyMapTest method testBasic.
private void testBasic(final Class<?> clazz) {
final String key = "testKey";
final String value = "testValue";
final PropertyAccessStrategyMapImpl accessStrategy = PropertyAccessStrategyMapImpl.INSTANCE;
final PropertyAccess access = accessStrategy.buildPropertyAccess(clazz, key);
final HashMap<String, String> map = new HashMap<>();
access.getSetter().set(map, value, null);
assertEquals(value, map.get(key));
assertEquals(value, access.getGetter().get(map));
}
use of org.hibernate.property.access.internal.PropertyAccessStrategyMapImpl in project hibernate-orm by hibernate.
the class PropertyAccessStrategyMapTest method testNonMap.
@Test
public void testNonMap() {
final PropertyAccessStrategyMapImpl accessStrategy = PropertyAccessStrategyMapImpl.INSTANCE;
try {
accessStrategy.buildPropertyAccess(Date.class, "time");
fail("Should throw IllegalArgumentException");
} catch (IllegalArgumentException e) {
assertEquals("Expecting class: [org.hibernate.mapping.Map], but containerJavaType is of type: [java.util.Date] for propertyName: [time]", e.getMessage());
}
}
Aggregations