use of org.simpleflatmapper.reflect.meta.DefaultPropertyNameMatcher in project SimpleFlatMapper by arnaudroger.
the class ConstructorPropertyMetaTest method testSetterIsNullSetter.
@Test
public void testSetterIsNullSetter() throws Exception {
PropertyMeta<CObject, Object> property = classMeta.newPropertyFinder(isValidPropertyMeta).findProperty(new DefaultPropertyNameMatcher("p1", 0, false, false), new Object[0]);
assertTrue(property.getSetter() instanceof NullSetter);
}
use of org.simpleflatmapper.reflect.meta.DefaultPropertyNameMatcher in project SimpleFlatMapper by arnaudroger.
the class DefaultPropertyNameMatcherTest method testFullMatchExactMath.
@Test
public void testFullMatchExactMath() {
PropertyNameMatcher matcher = new DefaultPropertyNameMatcher("my_col", 0, true, false);
assertTrue(matcher.matches("my_col"));
assertTrue(matcher.matches("my_COL"));
assertFalse(matcher.matches("myCol"));
}
use of org.simpleflatmapper.reflect.meta.DefaultPropertyNameMatcher in project SimpleFlatMapper by arnaudroger.
the class DefaultPropertyNameMatcherTest method testMatchIndex.
@Test
public void testMatchIndex() {
assertEquals(2, new DefaultPropertyNameMatcher("elt2", 0, false, false).matchIndex().getIndexValue());
assertEquals(2, new DefaultPropertyNameMatcher("elt_2", 0, false, false).matchIndex().getIndexValue());
assertNull(new DefaultPropertyNameMatcher("elt_ipv2", 0, false, false).matchIndex());
}
use of org.simpleflatmapper.reflect.meta.DefaultPropertyNameMatcher in project SimpleFlatMapper by arnaudroger.
the class DefaultPropertyNameMatcherTest method testFullMatch.
@Test
public void testFullMatch() {
PropertyNameMatcher matcher = new DefaultPropertyNameMatcher("my_Col", 0, false, false);
assertTrue(matcher.matches("myCol"));
assertTrue(matcher.matches("my_Col"));
assertTrue(matcher.matches("my Col"));
assertFalse(matcher.matches("myCo"));
assertFalse(matcher.matches("my__Col"));
assertFalse(matcher.matches("myCol2"));
}
use of org.simpleflatmapper.reflect.meta.DefaultPropertyNameMatcher in project SimpleFlatMapper by arnaudroger.
the class SelfPropertyMetaTest method testDirect.
@Test
public void testDirect() {
ClassMeta<String> direct = ReflectionService.newInstance().getClassMeta(String.class);
PropertyMeta<String, Object> property = direct.newPropertyFinder(isValidPropertyMeta).findProperty(new DefaultPropertyNameMatcher("bbb", 0, true, true), new Object[0]);
assertTrue("Expect SelfPropertyMeta " + property, property instanceof SelfPropertyMeta);
assertEquals("SelfPropertyMeta{type=class java.lang.String,name=self}", property.toString());
assertTrue(property.getGetter() instanceof IdentityGetter);
assertTrue(NullSetter.isNull(property.getSetter()));
assertEquals("{this}", property.getPath());
assertEquals(String.class, direct.getType());
}
Aggregations