package org.simpleflatmapper.reflect.meta;

import org.junit.Test;
import org.simpleflatmapper.reflect.getter.IdentityGetter;
import org.simpleflatmapper.reflect.ReflectionService;
import org.simpleflatmapper.reflect.setter.NullSetter;

import static org.junit.Assert.*;

public class DirectClassMetaTest {

    @Test
    public void testDirect() {
        ClassMeta<String> direct = ReflectionService.newInstance().getClassMeta(String.class);

        assertTrue(direct instanceof DirectClassMeta);
        assertEquals("DirectClassMeta{target=class java.lang.String}", direct.toString());

        PropertyMeta<String, Object> property = direct.newPropertyFinder().findProperty(new DefaultPropertyNameMatcher("bbb", 0, true, true));

        assertNull(direct.newPropertyFinder().getEligibleInstantiatorDefinitions());

        assertTrue(property instanceof DirectClassMeta.DirectPropertyMeta);
        assertEquals("DirectPropertyMeta{type=class java.lang.String,name=direct}", property.toString());

        assertTrue(property.getGetter() instanceof IdentityGetter);

        assertTrue(NullSetter.isNull(property.getSetter()));

        assertArrayEquals(new String[] {""},  direct.generateHeaders());

        assertEquals(".", property.getPath());

    }
}

@@ -230,16 +230,42 @@
 etter;%0A%0A
+import java.util.Arrays;%0A%0A
 import s
@@ -1273,20 +1273,461 @@
 etPath());%0A%0A
+        assertEquals(Arrays.asList(), direct.getInstantiatorDefinitions());%0A        assertEquals(String.class, direct.getType());%0A%0A        assertEquals(direct, direct);%0A        assertNotEquals(direct, ReflectionService.newInstance().getClassMeta(Integer.class));%0A        assertEquals(direct.hashCode(), direct.hashCode());%0A        assertNotEquals(direct.hashCode(), ReflectionService.newInstance().getClassMeta(Integer.class).hashCode());%0A%0A%0A
     %7D%0A%7D%0A

add test for direct class meta