public void testGlobalVisibilityForGetters() {
   ObjectMapper m = new ObjectMapper();
   m.configure(MapperFeature.AUTO_DETECT_GETTERS, false);
   POJOPropertiesCollector coll = collector(m, SimpleGetterVisibility.class, true);
   // should be 1, expect that we disabled getter auto-detection, so
   Map<String, POJOPropertyBuilder> props = coll.getPropertyMap();
   assertEquals(0, props.size());
 }
 public void testSimpleOrderingForDeserialization() {
   POJOPropertiesCollector coll = collector(mapper, SortedProperties.class, false);
   List<BeanPropertyDefinition> props = coll.getProperties();
   assertEquals(4, props.size());
   assertEquals("a", props.get(0).getName());
   assertEquals("b", props.get(1).getName());
   assertEquals("c", props.get(2).getName());
   assertEquals("d", props.get(3).getName());
 }
 public void testSimpleIgnoreAndRename() {
   POJOPropertiesCollector coll = collector(mapper, IgnoredRenamedSetter.class, true);
   Map<String, POJOPropertyBuilder> props = coll.getPropertyMap();
   assertEquals(1, props.size());
   POJOPropertyBuilder prop = props.get("y");
   assertNotNull(prop);
   assertTrue(prop.hasSetter());
   assertFalse(prop.hasGetter());
   assertFalse(prop.hasField());
 }
 public void testMergeWithRename() {
   POJOPropertiesCollector coll = collector(mapper, MergedProperties.class, true);
   Map<String, POJOPropertyBuilder> props = coll.getPropertyMap();
   assertEquals(1, props.size());
   POJOPropertyBuilder prop = props.get("x");
   assertNotNull(prop);
   assertTrue(prop.hasSetter());
   assertFalse(prop.hasGetter());
   assertTrue(prop.hasField());
 }
 public void testSimpleGetterVisibility() {
   POJOPropertiesCollector coll = collector(mapper, SimpleGetterVisibility.class, true);
   Map<String, POJOPropertyBuilder> props = coll.getPropertyMap();
   assertEquals(1, props.size());
   POJOPropertyBuilder prop = props.get("a");
   assertNotNull(prop);
   assertFalse(prop.hasSetter());
   assertTrue(prop.hasGetter());
   assertFalse(prop.hasField());
 }
 public void testCollectionOfIgnored() {
   POJOPropertiesCollector coll = collector(mapper, ImplicitIgnores.class, false);
   // should be 1, due to ignorals
   Map<String, POJOPropertyBuilder> props = coll.getPropertyMap();
   assertEquals(1, props.size());
   // but also have 2 ignored properties
   Collection<String> ign = coll.getIgnoredPropertyNames();
   assertEquals(2, ign.size());
   assertTrue(ign.contains("a"));
   assertTrue(ign.contains("b"));
 }
 public void testSimpleFieldVisibility() {
   // false -> deserialization
   POJOPropertiesCollector coll = collector(mapper, SimpleFieldDeser.class, false);
   Map<String, POJOPropertyBuilder> props = coll.getPropertyMap();
   assertEquals(1, props.size());
   POJOPropertyBuilder prop = props.get("values");
   assertNotNull(prop);
   assertFalse(prop.hasSetter());
   assertFalse(prop.hasGetter());
   assertTrue(prop.hasField());
 }
  public void testSimpleWithType() {
    // first for serialization; should base choice on getter
    POJOPropertiesCollector coll = collector(mapper, TypeTestBean.class, true);
    List<BeanPropertyDefinition> props = coll.getProperties();
    assertEquals(1, props.size());
    assertEquals("value", props.get(0).getName());
    AnnotatedMember m = props.get(0).getAccessor();
    assertTrue(m instanceof AnnotatedMethod);
    assertEquals(Integer.class, m.getRawType());

    // then for deserialization; prefer ctor param
    coll = collector(mapper, TypeTestBean.class, false);
    props = coll.getProperties();
    assertEquals(1, props.size());
    assertEquals("value", props.get(0).getName());
    m = props.get(0).getMutator();
    assertEquals(AnnotatedParameter.class, m.getClass());
    assertEquals(String.class, m.getRawType());
  }
 // Unit test for verifying that a single @JsonIgnore can remove the
 // whole property, unless explicit property marker exists
 public void testEmpty() {
   POJOPropertiesCollector coll = collector(mapper, Empty.class, true);
   Map<String, POJOPropertyBuilder> props = coll.getPropertyMap();
   assertEquals(0, props.size());
 }